Skip to content

Instantly share code, notes, and snippets.

@srigalamilitan
Created January 12, 2016 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srigalamilitan/c7e1538225bd97a1625a to your computer and use it in GitHub Desktop.
Save srigalamilitan/c7e1538225bd97a1625a to your computer and use it in GitHub Desktop.
@Override
public Map<String, Object> sendNotif(List<RequestEmailNotifHelper>requests) {
try {
//TODO: open remark after ready to implemented
HashMap<String, Object> param = new HashMap<>() ;
param.put(IEmailNotifConstans.IMailParamJson.TEMPLATE_ID,4568);
/**
* get MailTemplate Data (EmailUtil)
* **/
EnoMdTemplateHelper result= util.getMailTemplate(param);
System.out.println("#####TEMPLATE_ID####"+result.getTemplateId()) ;
List<EnoMdTemplateParamHelper> listDetailsSourcess = result.getDetailList();
List<EnoTxHdrEmailNotifHelper> listTarget = new ArrayList<EnoTxHdrEmailNotifHelper>();
Integer numberListSource = result.getDetailList().size();
Integer numberRequests = requests.size();
for(int j=0; j<numberRequests; j++){
EnoTxHdrEmailNotifHelper enoTxHdrEmailNotifHelper = new EnoTxHdrEmailNotifHelper();
List<EnoTxDtlEmailNotifHelper> listDetailsTarget = new ArrayList<EnoTxDtlEmailNotifHelper>();
for(int i=0; i<numberListSource; i++){
EnoTxDtlEmailNotifHelper target = new EnoTxDtlEmailNotifHelper();
target.setDtlEmailNotifId((long) 1);
target.setHdrEmailNotifId((long) 1);
target.setRdfName(listDetailsSourcess.get(i).getRdfName());
target.setCreatedBy(requests.get(j).getApprovedBy());
target.setCreatedOn(new Date());
target.setParamType(listDetailsSourcess.get(i).getParamType());
target.setParamName(listDetailsSourcess.get(i).getParamName());
target.setParamValue(String.valueOf(requests.get(j).getAcsId()));
target.setParamDataType(listDetailsSourcess.get(i).getParamDataType());
listDetailsTarget.add(i, target);
}
enoTxHdrEmailNotifHelper.setHdrEmailNotifId((long) 1);
enoTxHdrEmailNotifHelper.setTemplateId(result.getTemplateId());
enoTxHdrEmailNotifHelper.setEmailGroupCode(result.getEmailGroupCode());
enoTxHdrEmailNotifHelper.setEmailTypeCode(result.getEmailTypeCode());
enoTxHdrEmailNotifHelper.setRecipient("mankajus29@gmail.com");
enoTxHdrEmailNotifHelper.setMemberId((long)41);
enoTxHdrEmailNotifHelper.setCreatedBy(requests.get(j).getApprovedBy());
enoTxHdrEmailNotifHelper.setCreatedOn(new Date());
enoTxHdrEmailNotifHelper.setListDetails(listDetailsTarget);
enoTxHdrEmailNotifHelper.setSender("iskandarthegre4t@gmail.com");
listTarget.add(j,enoTxHdrEmailNotifHelper);
}
/**
* Do RegisterMail (EmailUtil)
* **/
util.registerMail(listTarget);
} catch (Exception e) {
e.printStackTrace();
Map<String, Object> errorMaster = new HashMap<>();
errorMaster.put("status", 500);
errorMaster.put(REST_ACS_PARAM_CONSTANT.ERROR_CODE, "ACSE006");
errorMaster.put("error_message", "Error Parameter");
return errorMaster;
}
Map<String, Object> responseSuccess = new HashMap<>();
responseSuccess.put("status", 200);
responseSuccess.put("message", "SUCCESS");
return responseSuccess;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment