List of usage examples for org.joda.time.format DateTimeFormatter print
public String print(ReadablePartial partial)
From source file:org.goobi.production.model.bibliography.course.Block.java
License:Open Source License
/** * The function toString() provides returns a string that contains a textual * representation of this block that is easy for a person to read. * * @param dateConverter/*ww w . j a v a 2 s . co m*/ * a DateTimeFormatter for formatting the local dates * @return a string to identify the block */ public String toString(DateTimeFormatter dateConverter) { StringBuilder result = new StringBuilder(); if (firstAppearance != null) { result.append(dateConverter.print(firstAppearance)); } result.append(" "); if (lastAppearance != null) { result.append(dateConverter.print(lastAppearance)); } return result.toString(); }
From source file:org.grouplens.lenskit.eval.traintest.JobStatusWriter.java
License:Open Source License
private void writeStatus() { try {/*from w w w . j av a2s . c o m*/ DateTimeFormatter format = DateTimeFormat.longDateTime(); DateTime now = DateTime.now(); Files.createParentDirs(outputFile); PrintWriter writer = new PrintWriter(outputFile); try { writer.println("status_time: " + format.print(now)); writer.println("summary:"); writer.println(" total: " + allJobs.size()); writer.println(" active: " + activeJobs.size()); writer.println(" completed: " + finishedJobs.size()); writer.println("running_tasks:"); for (TrainTestJob job : activeJobs) { writer.print("- task: "); writer.println(job); DateTime start = startTime.get(job); writer.format(" started: %s\n", format.print(start)); writer.println(" thread: " + threads.get(job).getName()); } } finally { writer.close(); } } catch (Exception ex) { logger.error("failed to write status", ex); } }
From source file:org.iexhub.connectors.PDQQueryManager.java
License:Apache License
/** * @param queryText//from w w w. j a v a2 s .c o m * @param patientId * @throws IOException */ private void logIti47AuditMsg(String queryText, String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti47AuditMsgTemplate)); // Substitutions... patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", PDQQueryManager.endpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); logMsg = logMsg.replace("$PatientIdMtom$", Base64.getEncoder().encodeToString(patientId.getBytes())); logMsg = logMsg.replace("$QueryByParameterMtom$", Base64.getEncoder().encodeToString(queryText.getBytes())); logMsg = logMsg.replace("$PatientId$", patientId); if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti47AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.iexhub.connectors.PIXManager.java
License:Apache License
/** * @param patientId/* w w w. ja v a2 s . c o m*/ * @throws IOException */ private void logIti44AuditMsg(String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti44AuditMsgTemplate)); // Substitutions... patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", PIXManager.endpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); logMsg = logMsg.replace("$PatientIdMtom$", Base64.getEncoder().encodeToString(patientId.getBytes())); logMsg = logMsg.replace("$PatientId$", patientId); if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti44AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.iexhub.connectors.PIXManager.java
License:Apache License
/** * @param queryText//from w ww . j a v a2 s.co m * @param patientId * @throws IOException */ private void logIti45AuditMsg(String queryText, String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti45AuditMsgTemplate)); // Substitutions... patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", PIXManager.endpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); // Query text must be Base64 encoded... logMsg = logMsg.replace("$PixQueryMtom$", Base64.getEncoder().encodeToString(queryText.getBytes())); logMsg = logMsg.replace("$PatientIdMtom$", Base64.getEncoder().encodeToString(patientId.getBytes())); logMsg = logMsg.replace("$PatientId$", patientId); if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti45AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.iexhub.connectors.XdsB.java
License:Apache License
/** * @param queryText//from w w w . ja v a 2 s .co m * @param patientId * @throws IOException */ private void logIti18AuditMsg(String queryText, String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti18AuditMsgTemplate)); // Substitutions... if ((patientId != null) && (patientId.length() > 0)) { patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); } else { patientId = new String(""); } DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", XdsB.registryEndpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); // Query text must be Base64 encoded... logMsg = logMsg.replace("$RegistryQueryMtom$", Base64.getEncoder().encodeToString(queryText.getBytes())); logMsg = logMsg.replace("$PatientId$", patientId); if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti18AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.iexhub.connectors.XdsB.java
License:Apache License
/** * @param documentId/*w ww . j av a2s . co m*/ * @param repositoryUniqueId * @param homeCommunityId * @param patientId * @throws IOException */ private void logIti43AuditMsg(String documentId, String repositoryUniqueId, String homeCommunityId, String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti43AuditMsgTemplate)); // Substitutions... if ((patientId != null) && (patientId.length() > 0)) { patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); } else { patientId = new String(""); } DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", XdsB.registryEndpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); // Repository ID text must be Base64 encoded... logMsg = logMsg.replace("$RepositoryIdMtom$", Base64.getEncoder().encodeToString(repositoryUniqueId.getBytes())); logMsg = logMsg.replace("$PatientId$", patientId); logMsg = logMsg.replace("$DocumentId$", documentId); if (homeCommunityId != null) { logMsg = logMsg.replace("$HomeCommunityId$", homeCommunityId); } else { logMsg = logMsg.replace("$HomeCommunityId$", ""); } if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti43AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.iexhub.connectors.XdsBRepositoryManager.java
License:Apache License
/** * @param submissionSetId/*from ww w . jav a 2 s . com*/ * @param patientId * @throws IOException */ private void logIti41AuditMsg(String submissionSetId, String patientId) throws IOException { String logMsg = FileUtils.readFileToString(new File(iti41AuditMsgTemplate)); // Substitutions... patientId = patientId.replace("'", ""); patientId = patientId.replace("&", "&"); DateTime now = new DateTime(DateTimeZone.UTC); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); logMsg = logMsg.replace("$DateTime$", fmt.print(now)); logMsg = logMsg.replace("$AltUserId$", "IExHub"); logMsg = logMsg.replace("$IexhubIpAddress$", InetAddress.getLocalHost().getHostAddress()); logMsg = logMsg.replace("$IexhubUserId$", "http://" + InetAddress.getLocalHost().getCanonicalHostName()); logMsg = logMsg.replace("$DestinationIpAddress$", XdsBRepositoryManager.repositoryEndpointUri); logMsg = logMsg.replace("$DestinationUserId$", "IExHub"); logMsg = logMsg.replace("$PatientId$", patientId); logMsg = logMsg.replace("$SubmissionSetId$", submissionSetId); if (logSyslogAuditMsgsLocally) { log.info(logMsg); } if ((sysLogConfig == null) || (iti41AuditMsgTemplate == null)) { return; } // Log the syslog message and close connection Syslog.getInstance("sslTcp").info(logMsg); Syslog.getInstance("sslTcp").flush(); }
From source file:org.igov.service.business.action.task.core.ActionTaskService.java
/** * ?? ?//from w ww . ja va 2 s . c o m * @param nID_Task - - ? * @return DTO- ProcessDTOCover */ public ProcessDTOCover getProcessInfoByTaskID(Long nID_Task) { LOG.info("start process getting Task Data by nID_Task = {}", nID_Task); HistoricTaskInstance historicTaskInstance = oHistoryService.createHistoricTaskInstanceQuery() .taskId(nID_Task.toString()).singleResult(); String sBP = historicTaskInstance.getProcessDefinitionId(); LOG.info("id-?-?? () sBP={}", sBP); ProcessDefinition processDefinition = oRepositoryService.createProcessDefinitionQuery() .processDefinitionId(sBP).singleResult(); String sName = processDefinition.getName(); LOG.info(" ? () sName={}", sName); Date oProcessInstanceStartDate = oHistoryService .createProcessInstanceHistoryLogQuery(getProcessInstanceIDByTaskID(nID_Task.toString())) .singleResult().getStartTime(); DateTimeFormatter formatter = JsonDateTimeSerializer.DATETIME_FORMATTER; String sDateCreate = formatter.print(oProcessInstanceStartDate.getTime()); LOG.info(" ?? ?? sDateCreate={}", sDateCreate); Long nID = Long.valueOf(historicTaskInstance.getProcessInstanceId()); LOG.info("id ?? (nID={})", nID.toString()); ProcessDTOCover oProcess = new ProcessDTOCover(sName, sBP, nID, sDateCreate); LOG.info("Created ProcessDTOCover={}", oProcess.toString()); return oProcess; }
From source file:org.igov.service.business.action.task.core.ActionTaskService.java
public Map<String, Object> populateTaskInfo(TaskInfo task, FlowSlotTicket flowSlotTicket) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Map<String, Object> taskInfo = new HashMap<String, Object>(); taskInfo.put("id", task.getId()); taskInfo.put("url", oGeneralConfig.sHost() + "/wf/service/runtime/tasks/" + task.getId()); taskInfo.put("owner", task.getOwner()); taskInfo.put("assignee", task.getAssignee()); taskInfo.put("delegationState", (task instanceof Task) ? ((Task) task).getDelegationState() : null); taskInfo.put("name", task.getName()); taskInfo.put("description", task.getDescription()); taskInfo.put("createTime", sdf.format(task.getCreateTime())); taskInfo.put("dueDate", task.getDueDate() != null ? sdf.format(task.getDueDate()) : null); taskInfo.put("priority", task.getPriority()); taskInfo.put("suspended", (task instanceof Task) ? ((Task) task).isSuspended() : null); taskInfo.put("taskDefinitionKey", task.getTaskDefinitionKey()); taskInfo.put("tenantId", task.getTenantId()); taskInfo.put("category", task.getCategory()); taskInfo.put("formKey", task.getFormKey()); taskInfo.put("parentTaskId", task.getParentTaskId()); taskInfo.put("parentTaskUrl", ""); taskInfo.put("executionId", task.getExecutionId()); taskInfo.put("executionUrl", oGeneralConfig.sHost() + "/wf/service/runtime/executions/" + task.getExecutionId()); taskInfo.put("processInstanceId", task.getProcessInstanceId()); taskInfo.put("processInstanceUrl", oGeneralConfig.sHost() + "/wf/service/runtime/process-instances/" + task.getProcessInstanceId()); taskInfo.put("processDefinitionId", task.getProcessDefinitionId()); taskInfo.put("processDefinitionUrl", oGeneralConfig.sHost() + "/wf/service/repository/process-definitions/" + task.getProcessDefinitionId()); taskInfo.put("variables", new LinkedList()); if (flowSlotTicket != null) { LOG.info("Populating flow slot ticket"); DateTimeFormatter dtf = org.joda.time.format.DateTimeFormat.forPattern("yyyy-MM-dd_HH-mm-ss"); Map<String, Object> flowSlotTicketData = new HashMap<String, Object>(); flowSlotTicketData.put("nID", flowSlotTicket.getId()); flowSlotTicketData.put("nID_Subject", flowSlotTicket.getnID_Subject()); flowSlotTicketData.put("sDateStart", flowSlotTicket.getsDateStart() != null ? dtf.print(flowSlotTicket.getsDateStart()) : null); flowSlotTicketData.put("sDateFinish", flowSlotTicket.getsDateFinish() != null ? dtf.print(flowSlotTicket.getsDateFinish()) : null); taskInfo.put("flowSlotTicket", flowSlotTicketData); }/*from w w w. j a v a2 s. co m*/ return taskInfo; }