List of usage examples for java.util Date toString
public String toString()
where:dow mon dd hh:mm:ss zzz yyyy
From source file:org.obiba.onyx.core.service.impl.DefaultAppointmentManagementServiceImpl.java
public List<AppointmentUpdateLog> getLogListForDate(Date date) { List<AppointmentUpdateLog> logList = new ArrayList<AppointmentUpdateLog>(); List<JobInstance> jobsList = jobExplorer.getJobInstances(job.getName(), 0, 10); JobExecution jobExecution = null;// w w w . j a va2s.c om for (JobInstance jobInstance : jobsList) { if (jobInstance.getJobParameters().getDate("date").toString().equals(date.toString())) { jobExecution = jobExplorer.getJobExecutions(jobInstance).get(0); break; } } if (jobExecution == null) return null; for (StepExecution stepExec : jobExecution.getStepExecutions()) { StepExecution stepExecution = jobExplorer.getStepExecution(jobExecution.getId(), stepExec.getId()); if (stepExecution.getExecutionContext().get("logList") != null) { logList.addAll((List<AppointmentUpdateLog>) (stepExecution.getExecutionContext().get("logList"))); } } return logList; }
From source file:org.eclipse.jubula.client.ui.controllers.propertysources.TestResultNodePropertySource.java
/** * Inits the PropertyDescriptors// w ww .jav a 2 s . c o m */ protected void initPropDescriptor() { clearPropertyDescriptors(); final INodePO node = m_node.getNode(); PropertyDescriptor propDes = new PropertyDescriptor(new ComponentController() { public Object getProperty() { final TestResultNode cap = m_node; Date time = cap.getTimeStamp(); if (time != null) { String timeStamp = time.toString(); return timeStamp; } return StringConstants.EMPTY; } }, P_ELEMENT_DISPLAY_TIMESTAMP); propDes.setCategory(P_TESTSTEP_CAT); addPropertyDescriptor(propDes); propDes = new PropertyDescriptor(new ComponentController() { public Object getProperty() { return m_node.getName(); } }, P_ELEMENT_DISPLAY_STEPNAME); propDes.setCategory(P_TESTSTEP_CAT); addPropertyDescriptor(propDes); propDes = new PropertyDescriptor(new ComponentController() { public Object getProperty() { return m_node.getTypeOfNode(); } public Image getImage() { return getImageForNode(node); } }, P_ELEMENT_DISPLAY_STEPTYPE); propDes.setCategory(P_TESTSTEP_CAT); addPropertyDescriptor(propDes); propDes = new PropertyDescriptor(new ComponentController() { public Object getProperty() { return node == null || node.getComment() == null ? StringUtils.EMPTY : node.getComment(); } }, P_ELEMENT_DISPLAY_CAPCOMMENT); propDes.setCategory(P_TESTSTEP_CAT); addPropertyDescriptor(propDes); initResultDetailsPropDesc(); if (Persistor.isPoSubclass(node, IEventExecTestCasePO.class)) { initEventTestCasePropDescriptor(node); } if (m_node.getEvent() != null) { initErrorEventPropDescriptor(); } initComponentNameDetailsPropDescriptor(m_node); initActionDetailsPropDescriptor(m_node); initParameterDescriptor(m_node); }
From source file:eu.cloud4soa.frontend.commons.server.services.soa.MonitoringServiceImpl.java
@Override public Map<String, Map<MonitoringMetricType, List<IMonitoringMetric>>> getMonitoringStatisticsWhithinRangeLimited( Map<String, String> appData, Date start, Date end, int maxResults, int monitoringMaxNumDisplayableValues) { logger.debug("Getting monitoring statistics for selected applications" + " between dates " + start.toString() + " and " + end.toString() + " with maxResults " + maxResults); Map<String, Map<MonitoringMetricType, List<IMonitoringMetric>>> results = new HashMap<String, Map<MonitoringMetricType, List<IMonitoringMetric>>>(); for (String applicationUriId : appData.keySet()) { results.put(applicationUriId, getMonitoringStatisticsWhithinRangeLimited(applicationUriId, appData.get(applicationUriId), start, end, maxResults, monitoringMaxNumDisplayableValues)); }//from w w w. j a v a2 s . co m return results; }
From source file:gov.nih.nci.ncicb.tcga.dcc.dam.service.FilePackagerEnqueuer.java
/** * Schedule a job to delete the given archive * * @param archiveName the archive name//w ww . j a v a 2s. c o m * @param immediate <code>true</code> if it should be scheduled immediately, <code>false</code> otherwise * @return the date at which the trigger will fire * @throws SchedulerException */ public Date queueArchiveDeletionJob(final String archiveName, final boolean immediate) throws SchedulerException { String name = UUID.randomUUID().toString(); JobDetail jobDetail = getJobDetail(); jobDetail.setName(name); jobDetail.setGroup(JOB_GROUP_ARCHIVE_DELETION); ArchiveDeletionBean archiveBean = new ArchiveDeletionBean(); archiveBean.setArchiveName(archiveName); jobDetail.getJobDataMap().put(JobDelegate.DATA_BEAN, archiveBean); jobDetail.getJobDataMap().put(JobDelegate.JOB_BEAN_NAME, SPRING_BEAN_NAME_FOR_ARCHIVE_DELETION_JOB); final Date now = getDateForArchiveDeletionSchedule(immediate); Trigger trigger = getTrigger(jobDetail, now); trigger.setPriority(PRIORITY_DELETION); log.info("Scheduling deletion of " + archiveName + getJobDetailString(jobDetail, trigger) + "at " + now.toString()); scheduleSmallJobs(jobDetail, trigger); return now; }
From source file:com.serena.rlc.provider.schedule.ScheduleExecutionProvider.java
@Action(name = WAIT_UNTIL, displayName = "Wait until (time)", description = "Wait until a specific time.") @Params(params = {/* w w w . j a v a 2 s . co m*/ @Param(fieldName = SCHEDULED_TIME, displayName = "Scheduled Time", description = "Scheduled time", required = true, environmentProperty = true, deployUnit = false, dataType = DataType.TEXT) }) public ExecutionInfo waitUntil(List<Field> properties, Boolean validateOnly) throws ProviderException { ExecutionInfo execInfo = new ExecutionInfo(); try { Boolean bValid = validateWaitUntil(properties); if (validateOnly) { logger.debug("Validating waitUntil with: " + properties.toString()); execInfo.setSuccess(bValid); execInfo.setMessage("Valid schedule action: " + WAIT_UNTIL); return execInfo; } else { UUID executionId = UUID.randomUUID(); Date scheduledDate; try { scheduledDate = new SimpleDateFormat(dateFormat).parse(scheduledTime); logger.debug("Scheduled date is: " + scheduledDate.toString()); } catch (ParseException ex) { throw new ProviderException("Invalid scheduled time, format is " + dateFormat); } long sleepTime = scheduledDate.getTime() - (new Date()).getTime(); try { ScheduleWaiter scheduleWaiter = new ScheduleWaiter(callbackUrl, callbackUsername, callbackPassword, executionId, sleepTime); Thread waiterThread = new Thread(scheduleWaiter, "ScheduleWaiter-" + executionId.toString()); waiterThread.start(); } catch (Exception ex) { throw new ProviderException(ex.getLocalizedMessage()); } execInfo.setStatus(ExecutionStatus.IN_PROGRESS); execInfo.setExecutionId(executionId.toString()); return execInfo; } } catch (ProviderException ex) { if (validateOnly) { execInfo.setSuccess(false); execInfo.setMessage(ex.getLocalizedMessage()); return execInfo; } throw ex; } }
From source file:com.all.client.model.ContactUserFolder.java
private String createId(String name, Date creationDate) { String hashcode = name + creationDate.toString() + new Random().nextLong(); try {// ww w . j ava 2 s. co m MessageDigest md = MessageDigest.getInstance("SHA1"); md.update(hashcode.getBytes()); hashcode = Hashcoder.toHex(md.digest()); } catch (NoSuchAlgorithmException e) { log.error(e, e); } return hashcode; }
From source file:com.espertech.esper.regression.pattern.TestFollowedByOperator.java
private long dateToLong(String dateText) throws ParseException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); Date date = format.parse(dateText); log.debug(".dateToLong out=" + date.toString()); return date.getTime(); }
From source file:cz.hobrasoft.pdfmu.operation.OperationInspect.java
private Signature display(PdfPKCS7 pkcs7) { Signature signature = new Signature(); // digitalsignatures20130304.pdf : Code sample 5.3 to.println("Signature metadata:"); {/*from w w w . java 2 s . c om*/ SignatureMetadata metadata = new SignatureMetadata(); to.indentMore(); // Only name may be null. // The values are set in {@link PdfPKCS7#verifySignature}. { // name String name = pkcs7.getSignName(); // May be null metadata.name = name; if (name == null) { to.println("Name is not set."); } else { to.println(String.format("Name: %s", name)); } } // TODO?: Print "N/A" if the value is an empty string // TODO?: Determine whether the value is set in the signature to.println(String.format("Reason: %s", pkcs7.getReason())); metadata.reason = pkcs7.getReason(); to.println(String.format("Location: %s", pkcs7.getLocation())); metadata.location = pkcs7.getLocation(); { // Date Date date = pkcs7.getSignDate().getTime(); to.println(String.format("Date and time: %s", date)); metadata.date = date.toString(); } to.indentLess(); signature.metadata = metadata; } { // Certificate chain to.indentMore("Certificate chain:"); Certificate[] certificates = pkcs7.getSignCertificateChain(); to.println(String.format("Number of certificates: %d", certificates.length)); int i = 0; List<CertificateResult> certificatesResult = new ArrayList<>(); for (Certificate certificate : certificates) { to.indentMore(String.format("Certificate %d%s:", i, (i == 0 ? " (the signing certificate)" : ""))); CertificateResult certRes; String type = certificate.getType(); to.println(String.format("Type: %s", type)); // http://docs.oracle.com/javase/1.5.0/docs/guide/security/CryptoSpec.html#AppA if ("X.509".equals(type)) { X509Certificate certificateX509 = (X509Certificate) certificate; certRes = showCertInfo(certificateX509); } else { certRes = new CertificateResult(); } certRes.type = type; to.indentLess(); certificatesResult.add(certRes); ++i; } signature.certificates = certificatesResult; to.indentLess(); } return signature; }
From source file:com.mentor.questa.vrm.jenkins.QuestaVrmHostAction.java
private JFreeChart createChart(StaplerRequest req, CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedAreaChart(null, // chart title "Relative time", // unused "count", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls );/*from w w w .ja v a 2 s .c o m*/ chart.setBackgroundPaint(Color.white); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setForegroundAlpha(0.8f); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.setCategoryMargin(0.0); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); StackedAreaRenderer ar = new StackedAreaRenderer2() { private long getTime(CategoryDataset dataset, int column) { Long offset = (Long) dataset.getColumnKey(column); return getRegressionResult().getRegressionBegin().getTime() + offset * 1000; } @Override public String generateURL(CategoryDataset dataset, int row, int column) { return "javascript:getSummary(" + getTime(dataset, column) + ");"; } @Override public String generateToolTip(CategoryDataset dataset, int row, int column) { String host = (String) dataset.getRowKey(row); Date date = new Date(getTime(dataset, column)); int value = (Integer) dataset.getValue(row, column); return value + " on " + host + "@" + date.toString(); } }; plot.setRenderer(ar); // crop extra space around the graph plot.setInsets(new RectangleInsets(0, 0, 0, 5.0)); return chart; }
From source file:gemlite.shell.commands.admin.ExecuteSql.java
@CliCommand(value = "execute sql", help = "execute sql") public boolean execute(@CliOption(key = "sql", mandatory = false) String sql, @CliOption(key = "file", mandatory = false) String file) { if (StringUtils.isEmpty(sql) && StringUtils.isEmpty(file)) return false; AsyncSqlProcessor processor = new AsyncSqlProcessor(new AntlrTableParser(), new SimpleMapperDao(), new GFDomainSender()); Date nowtime = new Date(); StringBuffer msgBuf = new StringBuffer(); msgBuf.append("timestamp:::" + nowtime.getTime() + "\n"); if (StringUtils.isNotEmpty(sql)) { msgBuf.append(sql);//from w ww.j ava 2 s . c o m processor.parserOneMessage(msgBuf.toString()); processor.remoteProcess(); StringBuilder info = new StringBuilder( "ExecuteSql :" + msgBuf.toString() + "Time is:" + nowtime.toString()); LogUtil.getCoreLog().info(info.toString()); System.out.println(info.toString()); } else if (StringUtils.isNotEmpty(file)) { try { LineNumberReader lr = new LineNumberReader(new FileReader(file)); String sqlline = lr.readLine(); int recvCount = 0; while (sqlline != null) { sqlline = sqlline.trim(); if (StringUtils.isNotEmpty(sqlline)) { if (sqlline.startsWith("insert") || sqlline.startsWith("update") || sqlline.startsWith("delete") || sqlline.startsWith("INSERT") || sqlline.startsWith("UPDATE") || sqlline.startsWith("DELETE")) { msgBuf.append("\n" + sqlline); recvCount++; } else { msgBuf.append(" " + sqlline); } } sqlline = lr.readLine(); } lr.close(); StringBuilder info = new StringBuilder("Read file ok. The Sql Number is " + recvCount); LogUtil.getCoreLog().info(info.toString()); System.out.println(info.toString()); processor.parserOneMessage(msgBuf.toString()); processor.remoteProcess(); } catch (IOException e) { LogUtil.getCoreLog().error("execute error, file:" + file, e); return false; } } return true; }