List of usage examples for com.liferay.portal.kernel.util GetterUtil getDate
public static Date getDate(String value, DateFormat dateFormat, Date defaultValue)
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public final boolean addPatientConsent(PatientConsentObject object, EhrPatientClientDto patient, HttpServletRequest request) {//from www .java2 s.c o m boolean consentCreated = false; PatientConsentObject result = null; SpiritUserClientDto usr = (SpiritUserClientDto) request.getSession() .getAttribute(EPSOS_LOGIN_INFORMATION_ATTRIBUTE); if (usr != null) { //upload consent document try { SpiritEhrWsClientInterface webservice = this.getWebService(request); List<PolicySetGroup> objGroupList = webservice.queryPolicySetsForPatient(patient).getGroupList(); String[] policyids = request.getParameterValues("policyid"); if (policyids != null && objGroupList != null) { for (PolicySetGroup g : objGroupList) { // first unselect all policies: for (PolicySetItem i : g.getPolicySetItemList()) { i.setSelected(false); } // then only select the ones selected by the user in the interface for (String id : policyids) { String groupCode = id.substring(0, id.indexOf("$$$")); if (groupCode.equals(g.getCode())) { String policyId = id.substring(id.indexOf("$$$") + 3); for (PolicySetItem i : g.getPolicySetItemList()) { if (i.getPolicySetId().equals(policyId)) { i.setSelected(true); GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); Date fromDate = GetterUtil.getDate( request.getParameter(groupCode + "$$$" + policyId + "_fromDate"), dateTimeFormat, null); if (fromDate != null) { cal.setTime(fromDate); XMLGregorianCalendar fromCal = DatatypeFactory.newInstance() .newXMLGregorianCalendar(cal); i.setEffectiveDateFrom(fromCal); } Date toDate = GetterUtil.getDate( request.getParameter(groupCode + "$$$" + policyId + "_toDate"), dateTimeFormat, null); if (toDate != null) { cal.setTime(toDate); XMLGregorianCalendar toCal = DatatypeFactory.newInstance() .newXMLGregorianCalendar(cal); i.setEffectiveDateTo(toCal); } } } } } } } EpsosHelperService.getInstance() .createLog("CREATE PATIENT CONSENT REQUEST:" + patient.getGivenName(), usr); webservice.saveConsent(patient, GeneralUtils.getLocale(request), "Patient Consent", objGroupList); consentCreated = true; EpsosHelperService.getInstance() .createLog("CREATE PATIENT CONSENT RESPONSE OK:" + patient.getGivenName(), usr); } catch (Exception e1) { EpsosHelperService.getInstance().createLog("CREATE PATIENT CONSENT RESPONSE FAILURE:" + patient.getGivenName() + ".ERROR: " + e1.getMessage(), usr); request.setAttribute("exception", e1.getMessage()); e1.printStackTrace(); } //result = object; } return consentCreated; }
From source file:com.ext.portlet.epsos.EpsosHelperService.java
public static boolean writeConsent(SpiritEhrWsClientInterface webservice, EhrPatientClientDto patient, String country, String language, String policy, String fromdate, String todate) { boolean consentCreated = false; PatientConsentObject result = null;// w w w. j av a2 s . c om if (true) { //upload consent document try { List<PolicySetGroup> objGroupList = webservice.queryPolicySetsForPatient(patient).getGroupList(); String[] policyids = new String[] { policy }; if (policyids != null && objGroupList != null) { for (PolicySetGroup g : objGroupList) { // first unselect all policies: for (PolicySetItem i : g.getPolicySetItemList()) { i.setSelected(false); } // then only select the ones selected by the user in the interface for (String id : policyids) { String groupCode = id.substring(0, id.indexOf("$$$")); _log.info("groupode=" + groupCode); if (groupCode.equals(g.getCode())) { String policyId = id.substring(id.indexOf("$$$") + 3); _log.info("policyid=" + policyId); for (PolicySetItem i : g.getPolicySetItemList()) { if (i.getPolicySetId().equals(policyId)) { i.setSelected(true); GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); Date fromDate = GetterUtil.getDate(fromdate, dateTimeFormat, null); if (fromDate != null) { cal.setTime(fromDate); XMLGregorianCalendar fromCal = DatatypeFactory.newInstance() .newXMLGregorianCalendar(cal); i.setEffectiveDateFrom(fromCal); } Date toDate = GetterUtil.getDate(todate, dateTimeFormat, null); if (toDate != null) { cal.setTime(toDate); XMLGregorianCalendar toCal = DatatypeFactory.newInstance() .newXMLGregorianCalendar(cal); i.setEffectiveDateTo(toCal); } } } } } } } EpsosHelperService.getInstance() .createLog("CREATE PATIENT CONSENT REQUEST:" + patient.getGivenName(), null); webservice.saveConsent(patient, language, "Patient Consent", objGroupList); consentCreated = true; EpsosHelperService.getInstance() .createLog("CREATE PATIENT CONSENT RESPONSE OK:" + patient.getGivenName(), null); } catch (Exception e1) { EpsosHelperService.getInstance().createLog("CREATE PATIENT CONSENT RESPONSE FAILURE:" + patient.getGivenName() + ".ERROR: " + e1.getMessage(), null); e1.printStackTrace(); } //result = object; } return consentCreated; }
From source file:org.kisti.edison.service.impl.WorkflowLocalServiceImpl.java
License:Open Source License
public WorkflowInstance createWorkflowInstance(String workflowUUID, Workflow workflow, HttpServletRequest request) throws SystemException, IOException { WorkflowInstance instance = WorkflowInstanceLocalServiceUtil.createWorkflowInstance(); JsonNode workflowStatusJson = askForWorkflowStatus(workflowUUID); MWorkflow workflowStatus = Transformer.json2Pojo(workflowStatusJson, MWorkflow.class); instance.setWorkflowId(workflow.getWorkflowId()); instance.setCompanyId(workflow.getCompanyId()); instance.setWorkflowUUID(workflowUUID); instance.setTitle(workflowStatus.getTitle()); instance.setCreateDate(GetterUtil.getDate(workflowStatus.getCreatedTime(), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), new Date())); instance.setUserId(workflow.getUserId()); instance.setStartTime(GetterUtil.getDate(workflowStatus.getStartTime(), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), new Date())); instance.setScreenLogic(workflow.getScreenLogic()); instance.setStatus(workflowStatus.getStatus()); instance.setStatusResponse(workflowStatusJson.toString()); WorkflowInstance savedWorkflowInstance = WorkflowInstanceLocalServiceUtil.addWorkflowInstance(instance); WorkflowInstanceLocalServiceUtil.addWorkflowWorkflowInstance(workflow.getWorkflowId(), savedWorkflowInstance.getWorkflowInstanceId()); return savedWorkflowInstance; }
From source file:org.kisti.edison.service.impl.WorkflowLocalServiceImpl.java
License:Open Source License
public WorkflowInstance updateWorkflowInstance(JsonNode workflowStatusJson, WorkflowInstance workflowInstance) throws SystemException { MWorkflow workflowStatus = Transformer.json2Pojo(workflowStatusJson, MWorkflow.class); workflowInstance.setStatus(workflowStatus.getStatus()); workflowInstance.setStatusResponse(workflowStatusJson.toString()); workflowInstance.setEndTime(GetterUtil.getDate(workflowStatus.getEndTime(), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), null)); return workflowInstanceLocalService.updateWorkflowInstance(workflowInstance); }