import java.util.concurrent.TimeUnit;
import java.lang.*;
import java.time.*;
import com.sap.gateway.ip.core.customdev.util.Message;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
def Message processData(Message message)
{
def map = message.getHeaders();
String getCertExpirydate = map.get("CertExpiryDate");
Date CertExpirydate = new SimpleDateFormat("yyyy-MM-dd").parse(getCertExpirydate);
Date dateNow = new Date(System.currentTimeMillis());
long dateDiff = CertExpirydate.getTime() - dateNow.getTime();
def daysToExpire = TimeUnit.DAYS.convert(dateDiff, TimeUnit.MILLISECONDS);
message.setHeader("daysToExpire",daysToExpire);
return message;
}
No comments:
Post a Comment