List of usage examples for org.apache.commons.lang.time DateFormatUtils format
public static String format(Date date, String pattern)
Formats a date/time into a specific pattern.
From source file:net.shopxx.plugin.pay99billPayment.Pay99billPaymentPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(sn); Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(PaymentPlugin.NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(PaymentPlugin.NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", paymentLog.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", DateFormatUtils.format(new Date(), "yyyyMMddhhmmss")); parameterMap.put("orderTimestamp", DateFormatUtils.format(new Date(), "yyyyMMddhhmmss")); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "shopxx"); parameterMap.put("payType", "00"); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:com.intuit.tank.agent.AgentBean.java
public void getAgentStatus(String jobId) { VMTracker tracker = new VMTrackerImpl(); CloudVmStatusContainer container = tracker.getVmStatusForJob(jobId); Set<CloudVmStatus> statuses = container.getStatuses(); for (CloudVmStatus cloudVmStatus : statuses) { AgentStatusReporter asr = new AgentStatusReporter(); asr.setActiveUsers(String.valueOf(cloudVmStatus.getCurrentUsers())); asr.setInstanceId(cloudVmStatus.getInstanceId()); asr.setJobId(cloudVmStatus.getJobId()); asr.setStartTime(DateFormatUtils.format(cloudVmStatus.getStartTime(), "mm/dd/yyyy HH:mm:ss")); asr.setEndTime(DateFormatUtils.format(cloudVmStatus.getEndTime(), "mm/dd/yyyy HH:mm:ss")); asr.setAgentStatus(cloudVmStatus.getVmStatus().toString()); asr.setRegion(cloudVmStatus.getVmRegion().toString()); asr.setRole(cloudVmStatus.getRole().toString()); asr.setJobStatus(cloudVmStatus.getJobStatus().toString()); asr.setTotalTime(""); asr.setTotalUsers(String.valueOf(cloudVmStatus.getTotalUsers())); asr.setUsersChange("0"); agents.add(asr);//w w w. j a v a2 s.c o m } }
From source file:net.shopxx.plugin.pay99billBankPayment.Pay99billBankPaymentPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(sn); Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(PaymentPlugin.NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(PaymentPlugin.NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", paymentLog.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", DateFormatUtils.format(new Date(), "yyyyMMddhhmmss")); parameterMap.put("orderTimestamp", DateFormatUtils.format(new Date(), "yyyyMMddhhmmss")); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "shopxx"); parameterMap.put("payType", "10"); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:com.drcl.yz.web.UploadAction.java
/** * //from w w w . ja v a 2 s . c om * * @return * @throws Exception */ @Override public String execute() throws Exception { String date = DateFormatUtils.format(new Date(), "yyyyMM"); String realPath = RequestUtils.getRealPath(ServletActionContext.getServletContext(), "/"); // ? String localFilePath = realPath + Global.picpath + "/" + date; try { if (file != null) { fileName = ""; List<String> fileTypes = Lists.newArrayList(); fileTypes.add("jpg"); fileTypes.add("gif"); fileTypes.add("png"); Image img = ImageIO.read(file); if (img == null) { message = "????"; return SUCCESS; } message = FileUploadUtils.fileTypeValidate(fileFileName, file, fileTypes, 1024); if (message == null) { fileName = FileUtils.saveFile(localFilePath, file, fileFileName, "im"); fileName = "/" + date + "/" + fileName; message = "?"; } } } catch (Exception e) { e.printStackTrace(); message = "?,!"; } return SUCCESS; }
From source file:de.ingrid.portal.scheduler.jobs.IngridMonitorAbstractJob.java
protected void updateJobData(JobExecutionContext context, int status, String statusCode) { JobDataMap dataMap = context.getJobDetail().getJobDataMap(); // verify JobDataMap checkJobDataMap(dataMap);// www. j a v a2 s . co m int eventOccurences; try { eventOccurences = dataMap.getInt(PARAM_EVENT_OCCURENCES); } catch (Exception e) { eventOccurences = 0; } int previousStatus = dataMap.getInt(PARAM_STATUS); String previousStatusCode = dataMap.getString(PARAM_STATUS_CODE); // if we have exactly the same result like the previous check // increase event occurences if (log.isDebugEnabled()) { log.debug("Previous status code:" + previousStatusCode); log.debug("New status code:" + statusCode); } if (status == previousStatus && previousStatusCode.equals(statusCode)) { eventOccurences++; } else { eventOccurences = 1; } if (status == STATUS_OK) { dataMap.put(PARAM_LAST_ERRORFREE_RUN, DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd H:mm:ss")); } dataMap.put(PARAM_STATUS, status); dataMap.put(PARAM_STATUS_CODE, statusCode); dataMap.put(PARAM_EVENT_OCCURENCES, eventOccurences); }
From source file:cn.vlabs.umt.ui.servlet.AppProxyServlet.java
private void genHalfProxy(HttpServletRequest request, HttpServletResponse response) throws IOException { String appname = request.getParameter("appname"); AppService service = (AppService) factory.getBean("ApplicationService"); Application app = service.getApplication(appname); AppCredContent content = new AppCredContent(); content.setAppKeyId(app.getKeyid()); content.setIpAddress(RequestUtil.getRemoteIP(request)); content.setPrincipal(new AppPrincipal(appname)); Date tommorow = DateUtils.addDays(new Date(), 1); content.setValidTime(DateFormatUtils.format(tommorow, "yyyy-MM-dd hh:mm:ss")); Application umt = service.getApplication("umt"); content.setUMTKeyId(umt.getKeyid()); // UMTCredential cred= (UMTCredential)factory.getBean("UMTCredUtil"); SignedEnvelope env = new SignedEnvelope(content.toXML()); // env.genSignature(cred.getUMTKey()); kevin deleted //TODO //FIXME response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.println(env.toXML());/*w w w .jav a2 s . c o m*/ out.flush(); out.close(); }
From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.PropertyValidatorTest.java
@SuppressWarnings("unused") @DataProvider/*from ww w. j av a2s. c om*/ private final static Object[][] getWorkingValues() { return new Object[][] { { createVarcharPropertyType(), "" }, { createVarcharPropertyType(), "varchar" }, { createTimestampPropertyType(), DateFormatUtils.format(new Date(), SupportedDatePattern.CANONICAL_DATE_PATTERN.getPattern()) }, { createIntegerPropertyType(), "1" }, { createRealPropertyType(), "1" }, { createRealPropertyType(), "1.1" }, { createBooleanPropertyType(), "yes" }, { createBooleanPropertyType(), "1" }, { createBooleanPropertyType(), "true" } }; }
From source file:ch.systemsx.cisd.openbis.generic.shared.dto.Session.java
@Override public final String toString() { return "Session{user=" + getUserName() + ",group=" + tryGetHomeGroupCode() + ",sessionstart=" + DateFormatUtils.format(getSessionStart(), DATE_FORMAT_PATTERN) + "}"; }
From source file:com.htmlhifive.tools.wizard.log.ResultStatus.java
/** * ?./*from ww w . j a va2 s. c om*/ * * @param e * @param message * @param params */ public void log(Throwable e, Message message, Object... params) { StringBuilder log = new StringBuilder(); log.append("["); log.append(DateFormatUtils.format(System.currentTimeMillis(), "hh:mm:ss.SSS")); log.append("] "); log.append(message.getLevel().name()); log.append(" "); log.append(message.getKey()); log.append(" "); log.append(message.format(params)); if (e != null) { setSuccess(false); // ?????????? log.append("\n"); log.append(ExceptionUtils.getStackTrace(e)); } log.append("\n"); put(message.getLevel(), log.toString(), e); }
From source file:cn.ipanel.apps.portalBackOffice.util.CommonsFiend.java
/** * @author liquan_apps//from www . ja v a 2 s . co m * @createTime 2007-1-28 19:32:51 * @param * @return * @since ****-**-** */ public static String nextDay(String today) { Calendar calendar = Calendar.getInstance(); long todayLong = stringToDate(today).getTime(); long lastDayLong = todayLong + 3600000 * 24; Date lastDay = new Date(lastDayLong); return DateFormatUtils.format(lastDay, Defines.FORMAT_DATE_STRING); }