List of usage examples for org.apache.commons.lang.time FastDateFormat getInstance
public static FastDateFormat getInstance(String pattern)
Gets a formatter instance using the specified pattern in the default locale.
From source file:org.okj.commons.web.fileupload.AbstractFileUploadToolkit.java
/** * //ww w .ja va 2 s.com * @param file * @return */ protected File getStoreUploadFile(UploadFile file, HttpServletRequest request) { String ext = FilenameUtils.getExtension(file.getFileName()); // FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd"); String today = fdf.format(new Date()); String path = StringUtils.replace(today, "-", File.separator); CreateRandomFile RandomFile = new CreateRandomFile(request); File storeFile = RandomFile.create(path, ext); LogUtils.info(LOGGER, ", storeFile={0}", storeFile); return storeFile; }
From source file:org.oscarehr.common.dao.ConsultRequestDao.java
private String getSearchQuery(ConsultationRequestSearchFilter filter, boolean selectCountOnly) { StringBuilder sql = new StringBuilder("select " + (selectCountOnly ? "count(*)" : "cr,specialist,cs,d,p") + " from ConsultationRequest cr left outer join cr.professionalSpecialist specialist, ConsultationServices cs, Demographic d" + " left outer join d.provider p where d.DemographicNo = cr.demographicId and cs.id = cr.serviceId "); if (filter.getAppointmentStartDate() != null) { sql.append("and cr.appointmentDate >= '" + FastDateFormat.getInstance("yyyy-MM-dd").format(filter.getAppointmentStartDate()) + "' "); }// w w w. java 2 s. c o m if (filter.getAppointmentEndDate() != null) { sql.append("and cr.appointmentDate <= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getAppointmentEndDate()) + " 23:59:59' "); } if (filter.getReferralStartDate() != null) { sql.append("and cr.referralDate >= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getReferralStartDate()) + "' "); } if (filter.getReferralEndDate() != null) { sql.append("and cr.referralDate <= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getReferralEndDate()) + " 23:59:59' "); } if (filter.getStatus() != null) { sql.append("and cr.status = '" + filter.getStatus() + "' "); } else { sql.append("and cr.status != 4 "); } if (StringUtils.isNotBlank(filter.getTeam())) { sql.append("and cr.sendTo = '" + StringEscapeUtils.escapeSql(filter.getTeam()) + "' "); } if (StringUtils.isNotBlank(filter.getUrgency())) { sql.append("and cr.urgency = '" + StringEscapeUtils.escapeSql(filter.getUrgency()) + "' "); } if (filter.getDemographicNo() != null && filter.getDemographicNo().intValue() > 0) { sql.append("and cr.demographicId = " + StringEscapeUtils.escapeSql(filter.getDemographicNo().toString()) + " "); } String orderBy = "cr.referralDate"; String orderDir = "desc"; if (filter.getSortDir() != null) { orderDir = filter.getSortDir().toString(); } if (SORTMODE.AppointmentDate.equals(filter.getSortMode())) { orderBy = "cr.appointmentDate " + orderDir + ",cr.appointmentTime " + orderDir; } else if (SORTMODE.Demographic.equals(filter.getSortMode())) { orderBy = "d.LastName " + orderDir + ",d.FirstName " + orderDir; } else if (SORTMODE.Service.equals(filter.getSortMode())) { orderBy = "cs.serviceDesc " + orderDir; } else if (SORTMODE.Consultant.equals(filter.getSortMode())) { orderBy = "specialist.lastName " + orderDir + ",specialist.firstName " + orderDir; } else if (SORTMODE.Team.equals(filter.getSortMode())) { orderBy = "cr.sendTo " + orderDir; } else if (SORTMODE.Status.equals(filter.getSortMode())) { orderBy = "cr.status " + orderDir; } else if (SORTMODE.MRP.equals(filter.getSortMode())) { orderBy = "p.LastName " + orderDir + ",p.FirstName " + orderDir; } else if (SORTMODE.FollowUpDate.equals(filter.getSortMode())) { orderBy = "cr.followUpDate " + orderDir; } else if (SORTMODE.ReferralDate.equals(filter.getSortMode())) { orderBy = "cr.referralDate " + orderDir; } else if (SORTMODE.Urgency.equals(filter.getSortMode())) { orderBy = "cr.urgency " + orderDir; } orderBy = " ORDER BY " + orderBy; sql.append(orderBy); return sql.toString(); }
From source file:org.oscarehr.common.dao.ConsultResponseDao.java
private String getSearchQuery(ConsultationResponseSearchFilter filter, boolean selectCountOnly) { StringBuilder sql = new StringBuilder("select " + (selectCountOnly ? "count(*)" : "cr,sp,d,p") + " from ConsultationResponse cr , ProfessionalSpecialist sp, Demographic d left outer join d.provider p" + " where sp.id = cr.referringDocId and d.DemographicNo = cr.demographicNo "); if (filter.getAppointmentStartDate() != null) { sql.append("and cr.appointmentDate >= '" + FastDateFormat.getInstance("yyyy-MM-dd").format(filter.getAppointmentStartDate()) + "' "); }//from www.j ava 2 s . c om if (filter.getAppointmentEndDate() != null) { sql.append("and cr.appointmentDate <= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getAppointmentEndDate()) + " 23:59:59' "); } if (filter.getReferralStartDate() != null) { sql.append("and cr.referralDate >= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getReferralStartDate()) + "' "); } if (filter.getReferralEndDate() != null) { sql.append("and cr.referralDate <= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getReferralEndDate()) + " 23:59:59' "); } if (filter.getResponseStartDate() != null) { sql.append("and cr.responseDate >= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getResponseStartDate()) + "' "); } if (filter.getResponseEndDate() != null) { sql.append("and cr.responseDate <= '" + DateFormatUtils.ISO_DATE_FORMAT.format(filter.getResponseEndDate()) + " 23:59:59' "); } if (filter.getStatus() != null) { sql.append("and cr.status = '" + filter.getStatus() + "' "); } else { sql.append("and cr.status != 4 "); } if (StringUtils.isNotBlank(filter.getTeam())) { sql.append("and cr.sendTo = '" + StringEscapeUtils.escapeSql(filter.getTeam()) + "' "); } if (StringUtils.isNotBlank(filter.getUrgency())) { sql.append("and cr.urgency = '" + StringEscapeUtils.escapeSql(filter.getUrgency()) + "' "); } if (filter.getDemographicNo() != null && filter.getDemographicNo().intValue() > 0) { sql.append("and cr.demographicNo = " + StringEscapeUtils.escapeSql(filter.getDemographicNo().toString()) + " "); } String orderBy = "cr.referralDate"; String orderDir = "desc"; if (filter.getSortDir() != null) { orderDir = filter.getSortDir().toString(); } if (SORTMODE.AppointmentDate.equals(filter.getSortMode())) { orderBy = "cr.appointmentDate " + orderDir + ",cr.appointmentTime " + orderDir; } else if (SORTMODE.Demographic.equals(filter.getSortMode())) { orderBy = "d.LastName " + orderDir + ",d.FirstName " + orderDir; } else if (SORTMODE.ReferringDoctor.equals(filter.getSortMode())) { orderBy = "sp.lastName " + orderDir + ",sp.firstName " + orderDir; } else if (SORTMODE.Team.equals(filter.getSortMode())) { orderBy = "cr.sendTo " + orderDir; } else if (SORTMODE.Status.equals(filter.getSortMode())) { orderBy = "cr.status " + orderDir; } else if (SORTMODE.Provider.equals(filter.getSortMode())) { orderBy = "p.LastName " + orderDir + ",p.FirstName " + orderDir; } else if (SORTMODE.FollowUpDate.equals(filter.getSortMode())) { orderBy = "cr.followUpDate " + orderDir; } else if (SORTMODE.ReferralDate.equals(filter.getSortMode())) { orderBy = "cr.referralDate " + orderDir; } else if (SORTMODE.ResponseDate.equals(filter.getSortMode())) { orderBy = "cr.responseDate " + orderDir; } else if (SORTMODE.Urgency.equals(filter.getSortMode())) { orderBy = "cr.urgency " + orderDir; } orderBy = " ORDER BY " + orderBy; sql.append(orderBy); return sql.toString(); }
From source file:org.signserver.server.log.EjbcaPatternLogger.java
/** * @param m A matcher that is used together with orderstring to determine how output is formatted * @param orderString A string that matches the pattern in m and specifies the order in which values are logged by the logger * @param logger A log4j Logger that is used for output * @param logDateFormat A string that specifies how the log-time is formatted * @param timeZone//w w w . j a v a 2 s . c o m */ public EjbcaPatternLogger(Matcher m, String orderString, Logger logger, String logDateFormat, String timeZone, Priority level) { this.m = m; this.orderString = orderString; this.logger = logger; this.logDateFormat = logDateFormat; this.timeZone = timeZone; this.startTime = new Date(); final FastDateFormat dateformat; if (this.timeZone == null) { dateformat = FastDateFormat.getInstance(this.logDateFormat); } else { dateformat = FastDateFormat.getInstance(this.logDateFormat, TimeZone.getTimeZone(this.timeZone)); } this.priority = level; paramPut(LOG_TIME, dateformat.format(new Date())); this.paramPut(REPLY_TIME, REPLY_TIME); this.paramPut(LOG_ID, "0"); }