List of usage examples for java.text DateFormat LONG
int LONG
To view the source code for java.text DateFormat LONG.
Click Source Link
From source file:org.pentaho.platform.scheduler.SchedulerAdminUIComponent.java
/** * This formatter works with a date/time string with this format: * May 21, 2008 8:29:21 PM// w w w .j av a 2 s . co m * * NOTE: the formatter cannot be shared across threads (since DateFormat implementations * are not guaranteed to be thread safe) or across sessions (since different * sessions may have different locales). So create a new one an each call. * @return */ private DateFormat getDateTimeFormatter() { return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, LocaleHelper.getLocale()); }
From source file:taximetro.main.java
private void jButtonfinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonfinActionPerformed //Establecer de nuevo parametros de los botones de fin y comienzo carrera. jButtonfin.setEnabled(false);/* w w w.j a v a2s . co m*/ jButtoncomienzo.setEnabled(true); //Parar el contador. cronometro.stop(); //Darle formato HH:mm:ss al resultado del contador. String tiempotexto = DurationFormatUtils.formatDuration(cronometro.getTime(), "HH:mm:ss"); //Guardar la hora de fin de carrera al presionar botn de fin carrera. Calendar tiempo = Calendar.getInstance(zona); //Dar formato a la hora de fin de carrera al presionar el boton de fin. DateFormat formatohoras = DateFormat.getTimeInstance(DateFormat.MEDIUM); String horafincarrera = formatohoras.format(tiempo.getTimeInMillis()); //Dar formato a la fecha. DateFormat formatotiempo = DateFormat.getDateInstance(DateFormat.LONG); String fechatexto = formatotiempo.format(tiempo.getTime()); //Calcular el coste del trayecto, a partir del tiempo del contador. float coste = (cronometro.getTime() / 1000) * (TARIFA / 60); float iva = coste * 0.21F; float costetotal = coste * 1.21F; //Dar formato al coste del trayecto. NumberFormat formatoeuro = NumberFormat.getCurrencyInstance(zona); //Escribir en el area de texto todos los parmetros. jTextAreaticket.append("TICKET:\n \n"); jTextAreaticket.append("=================\n"); jTextAreaticket.append("Ticket N: " + textoticket + " .\n"); jTextAreaticket.append("Fecha:\n" + fechatexto + " .\n\n"); jTextAreaticket.append("Hora de comienzo de carrera: " + horacomienzocarrera + " .\n"); jTextAreaticket.append("Hora de fin de carrera: " + horafincarrera + " .\n"); jTextAreaticket.append("El tiempo del trayecto es: " + tiempotexto + " .\n\n\n"); jTextAreaticket.append("Importe: " + formatoeuro.format(coste) + " .\n"); jTextAreaticket.append("IVA: " + formatoeuro.format(iva) + " .\n"); jTextAreaticket.append("Importe Total: " + formatoeuro.format(costetotal) + " .\n"); }
From source file:org.squale.squalecommon.enterpriselayer.facade.quality.MeasureFacade.java
/** * Creation d'une mesure de type Kiviat pour un projet * /*w ww . j a v a2 s . c o m*/ * @param pProjectId Id du projet * @param pAuditId Id de l'audit * @param pAllFactors tous les facteurs (= "true") ou seulement ceux ayant une note ? * @throws JrafEnterpriseException en cas de pb Hibernate * @return tableau d'objets : la map des donnes + le boolen pour affichage de la case cocher tous les facteurs */ public static Object[] getProjectKiviat(Long pProjectId, Long pAuditId, String pAllFactors) throws JrafEnterpriseException { Map result = new HashMap(); JFreeChart projectKiviat = null; MeasureDAOImpl measureDAO = MeasureDAOImpl.getInstance(); // Session Hibernate ISession session = null; // Boolen conditonnanant l'affichage de la case cocher "tous les facteurs" dans la page Jsp boolean displayCheckBoxFactors = true; try { // rcupration d'une session session = PERSISTENTPROVIDER.getSession(); // On ajoute les notes de chaque projets sur le kiviat ProjectBO project = (ProjectBO) ProjectDAOImpl.getInstance().load(session, pProjectId); SortedMap values = new TreeMap(); // recupere les facteurs du projet Collection factorResults = QualityResultDAOImpl.getInstance().findWhere(session, pProjectId, pAuditId); // et cree le map nom => note correspondant Iterator it = factorResults.iterator(); ArrayList nullValuesList = new ArrayList(); while (it.hasNext()) { FactorResultBO factor = (FactorResultBO) it.next(); // le -1 est trait directement par le kiviatMaker Float value = new Float(factor.getMeanMark()); // ajoute la note dans le titre // TODO prendre le vritable nom du facteur String name = factor.getRule().getName(); if (value.floatValue() >= 0) { // avec 1 seul chiffre aprs la virgule NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(1); nf.setMaximumFractionDigits(1); name = name + " (" + nf.format(value) + ")"; } else { // Mmorisation temporaire des facteurs pour lesquels les notes sont nulles : sera utile si l'option // "Tous les facteurs" est coche pour afficher uniquement les facteurs ayant une note. nullValuesList.add(name); } values.put(name, value); } final int FACTORS_MIN = 3; if (nullValuesList.size() <= 0 || values.size() <= FACTORS_MIN) { displayCheckBoxFactors = false; } // Seulement les facteurs ayant une note ? ==> suppression des facteurs ayant une note nulle. // Mais trois facteurs doivent au moins s'afficher (nuls ou pas !) values = deleteFactors(values, nullValuesList, pAllFactors, FACTORS_MIN); // recupre le nom de l'audit String name = null; AuditBO audit = (AuditBO) AuditDAOImpl.getInstance().load(session, pAuditId); if (audit.getType().compareTo(AuditBO.MILESTONE) == 0) { name = audit.getName(); } if (null == name) { DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); name = df.format(audit.getDate()); } result.put(name, values); } catch (Exception e) { FacadeHelper.convertException(e, MeasureFacade.class.getName() + ".getMeasures"); } finally { FacadeHelper.closeSession(session, MeasureFacade.class.getName() + ".getMeasures"); } Object[] kiviatObject = { result, new Boolean(displayCheckBoxFactors) }; return kiviatObject; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * Sets all the axis formatting options. This includes the colors and fonts to use on * the axis as well as the color to use when drawing the axis line. * * @param axis the axis to format/*from ww w.ja va 2 s .c o m*/ * @param labelFont the font to use for the axis label * @param labelColor the color of the axis label * @param tickLabelFont the font to use for each tick mark value label * @param tickLabelColor the color of each tick mark value label * @param tickLabelMask formatting mask for the label. If the axis is a NumberAxis then * the mask should be <code>java.text.DecimalFormat</code> mask, and * if it is a DateAxis then the mask should be a * <code>java.text.SimpleDateFormat</code> mask. * @param verticalTickLabels flag to draw tick labels at 90 degrees * @param lineColor color to use when drawing the axis line and any tick marks */ protected void configureAxis(Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Color lineColor, boolean isRangeAxis, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) { axis.setLabelFont(fontUtil.getAwtFont(getFont(labelFont), getLocale())); axis.setTickLabelFont(fontUtil.getAwtFont(getFont(tickLabelFont), getLocale())); if (labelColor != null) { axis.setLabelPaint(labelColor); } if (tickLabelColor != null) { axis.setTickLabelPaint(tickLabelColor); } if (lineColor != null) { axis.setAxisLinePaint(lineColor); axis.setTickMarkPaint(lineColor); } TimeZone timeZone = chartContext.getTimeZone(); if (axis instanceof DateAxis && timeZone != null) { // used when no mask is set ((DateAxis) axis).setTimeZone(timeZone); } // FIXME use locale for formats if (tickLabelMask != null) { if (axis instanceof NumberAxis) { NumberFormat fmt = NumberFormat.getInstance(getLocale()); if (fmt instanceof DecimalFormat) { ((DecimalFormat) fmt).applyPattern(tickLabelMask); } ((NumberAxis) axis).setNumberFormatOverride(fmt); } else if (axis instanceof DateAxis) { DateFormat fmt; if (tickLabelMask.equals("SHORT") || tickLabelMask.equals("DateFormat.SHORT")) { fmt = DateFormat.getDateInstance(DateFormat.SHORT, getLocale()); } else if (tickLabelMask.equals("MEDIUM") || tickLabelMask.equals("DateFormat.MEDIUM")) { fmt = DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale()); } else if (tickLabelMask.equals("LONG") || tickLabelMask.equals("DateFormat.LONG")) { fmt = DateFormat.getDateInstance(DateFormat.LONG, getLocale()); } else if (tickLabelMask.equals("FULL") || tickLabelMask.equals("DateFormat.FULL")) { fmt = DateFormat.getDateInstance(DateFormat.FULL, getLocale()); } else { fmt = new SimpleDateFormat(tickLabelMask, getLocale()); } if (timeZone != null) { fmt.setTimeZone(timeZone); } ((DateAxis) axis).setDateFormatOverride(fmt); } // ignore mask for other axis types. } if (verticalTickLabels != null && axis instanceof ValueAxis) { ((ValueAxis) axis).setVerticalTickLabels(verticalTickLabels); } setAxisBounds(axis, isRangeAxis, axisMinValue, axisMaxValue); }
From source file:org.wise.portal.domain.admin.DailyAdminJob.java
public String getSummaryMessage() { // do the actual work String messageBody = ""; DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); List<Run> runsCreatedSinceYesterday = findRunsCreatedSinceYesterday(); messageBody += "Number of Runs started between " + df.format(yesterday) + " and " + df.format(today) + ": " + runsCreatedSinceYesterday.size() + "\n"; // show info about the run for (Run run : runsCreatedSinceYesterday) { messageBody += "\tProject:" + run.getProject().getName(); Set<User> owners = run.getOwners(); User owner = owners.iterator().next(); TeacherUserDetails teacherUserDetails = (TeacherUserDetails) owner.getUserDetails(); String schoolName = teacherUserDetails.getSchoolname(); String schoolCity = teacherUserDetails.getCity(); String schoolState = teacherUserDetails.getState(); messageBody += "\n\tTeacher Username:" + teacherUserDetails.getUsername(); messageBody += "\n\tTeacher School Info: " + schoolName + ", " + schoolCity + ", " + schoolState; messageBody += "\n\n"; }/* w w w . j a va2 s .co m*/ List<User> teachersJoinedSinceYesterday = findUsersJoinedSinceYesterday("teacherUserDetails"); messageBody += "\n\n"; messageBody += "Number of Teachers joined between " + df.format(yesterday) + " and " + df.format(today) + ": " + teachersJoinedSinceYesterday.size(); List<User> studentsJoinedSinceYesterday = findUsersJoinedSinceYesterday("studentUserDetails"); messageBody += "\n\n"; messageBody += "Number of Students joined between " + df.format(yesterday) + " and " + df.format(today) + ": " + studentsJoinedSinceYesterday.size(); // Number of Users that logged in at least once in the last day List<User> studentsWhoLoggedInSinceYesterday = findUsersWhoLoggedInSinceYesterday("studentUserDetails"); List<User> teachersWhoLoggedInSinceYesterday = findUsersWhoLoggedInSinceYesterday("teacherUserDetails"); int totalNumUsersLoggedInSinceYesterday = studentsWhoLoggedInSinceYesterday.size() + teachersWhoLoggedInSinceYesterday.size(); messageBody += "\n\n"; messageBody += "Number of users who logged in at least once between " + df.format(yesterday) + " and " + df.format(today) + ": " + totalNumUsersLoggedInSinceYesterday; return messageBody; }
From source file:com.concursive.connect.web.modules.calendar.workflow.SendEventMeetingInvitation.java
private String formatUserTimestamp(Timestamp timestamp, User user) { // Use the user's locale SimpleDateFormat formatter = (SimpleDateFormat) SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, user.getLocale()); // Adjust the date/time based on any timezone if (user.getTimeZone() != null) { TimeZone tz = TimeZone.getTimeZone(user.getTimeZone()); formatter.setTimeZone(tz);//from w ww . j ava2 s . com } return formatter.format(timestamp); }
From source file:ubic.gemma.web.controller.expression.experiment.ExpressionExperimentController.java
/** * AJAX method to get data for database summary table, returned as a JSON object the slow part here is loading each * new or updated object in whatsNewService.retrieveReport() -> fetch() * * @return json//ww w . java 2 s. co m */ public JSONObject loadCountsForDataSummaryTable() { JSONObject summary = new JSONObject(); net.sf.json.JSONArray taxonEntries = new net.sf.json.JSONArray(); long bioMaterialCount = bioMaterialService.countAll(); long arrayDesignCount = arrayDesignService.countAll(); Map<Taxon, Long> unsortedEEsPerTaxon = expressionExperimentService.getPerTaxonCount(); /* * Sort taxa by name. */ TreeMap<Taxon, Long> eesPerTaxon = new TreeMap<>(new Comparator<Taxon>() { @Override public int compare(Taxon o1, Taxon o2) { return o1.getScientificName().compareTo(o2.getScientificName()); } }); long expressionExperimentCount = 0; // expressionExperimentService.countAll(); for (Taxon t : unsortedEEsPerTaxon.keySet()) { Long c = unsortedEEsPerTaxon.get(t); eesPerTaxon.put(t, c); expressionExperimentCount += c; } // this is the slow part WhatsNew wn = whatsNewService.retrieveReport(); if (wn == null) { wn = whatsNewService.getReport(); } if (wn != null) { // Get count for new assays int newBioMaterialCount = wn.getNewBioMaterialCount(); Collection<ExpressionExperiment> newExpressionExperiments = wn.getNewExpressionExperiments(); Collection<Long> newExpressionExperimentIds = (newExpressionExperiments != null) ? EntityUtils.getIds(newExpressionExperiments) : new ArrayList<Long>(); Collection<ExpressionExperiment> updatedExpressionExperiments = wn.getUpdatedExpressionExperiments(); Collection<Long> updatedExpressionExperimentIds = (updatedExpressionExperiments != null) ? EntityUtils.getIds(updatedExpressionExperiments) : new ArrayList<Long>(); int newExpressionExperimentCount = (newExpressionExperiments != null) ? newExpressionExperiments.size() : 0; int updatedExpressionExperimentCount = (updatedExpressionExperiments != null) ? updatedExpressionExperiments.size() : 0; /* Store counts for new and updated experiments by taxonId */ Map<Taxon, Collection<Long>> newEEsPerTaxon = wn.getNewEEIdsPerTaxon(); Map<Taxon, Collection<Long>> updatedEEsPerTaxon = wn.getUpdatedEEIdsPerTaxon(); for (Taxon t : unsortedEEsPerTaxon.keySet()) { JSONObject taxLine = new JSONObject(); taxLine.put("taxonId", t.getId()); taxLine.put("taxonName", t.getScientificName()); taxLine.put("totalCount", eesPerTaxon.get(t)); if (newEEsPerTaxon.containsKey(t)) { taxLine.put("newCount", newEEsPerTaxon.get(t).size()); taxLine.put("newIds", newEEsPerTaxon.get(t)); } if (updatedEEsPerTaxon.containsKey(t)) { taxLine.put("updatedCount", updatedEEsPerTaxon.get(t).size()); taxLine.put("updatedIds", updatedEEsPerTaxon.get(t)); } taxonEntries.add(taxLine); } summary.element("sortedCountsPerTaxon", taxonEntries); // Get count for new and updated array designs Collection<ArrayDesign> newArrayDesigns = wn.getNewArrayDesigns(); int newArrayCount = (newArrayDesigns != null) ? newArrayDesigns.size() : 0; Collection<ArrayDesign> updatedArrayDesigns = wn.getUpdatedArrayDesigns(); int updatedArrayCount = (updatedArrayDesigns != null) ? updatedArrayDesigns.size() : 0; boolean drawNewColumn = (newExpressionExperimentCount > 0 || newArrayCount > 0 || newBioMaterialCount > 0); boolean drawUpdatedColumn = (updatedExpressionExperimentCount > 0 || updatedArrayCount > 0); String date = (wn.getDate() != null) ? DateFormat.getDateInstance(DateFormat.LONG).format(wn.getDate()) : ""; date = date.replace('-', ' '); summary.element("updateDate", date); summary.element("drawNewColumn", drawNewColumn); summary.element("drawUpdatedColumn", drawUpdatedColumn); if (newBioMaterialCount != 0) summary.element("newBioMaterialCount", new Long(newBioMaterialCount)); if (newArrayCount != 0) summary.element("newArrayDesignCount", new Long(newArrayCount)); if (updatedArrayCount != 0) summary.element("updatedArrayDesignCount", new Long(updatedArrayCount)); if (newExpressionExperimentCount != 0) summary.element("newExpressionExperimentCount", newExpressionExperimentCount); if (updatedExpressionExperimentCount != 0) summary.element("updatedExpressionExperimentCount", updatedExpressionExperimentCount); if (newExpressionExperimentCount != 0) summary.element("newExpressionExperimentIds", newExpressionExperimentIds); if (updatedExpressionExperimentCount != 0) summary.element("updatedExpressionExperimentIds", updatedExpressionExperimentIds); } summary.element("bioMaterialCount", bioMaterialCount); summary.element("arrayDesignCount", arrayDesignCount); summary.element("expressionExperimentCount", expressionExperimentCount); return summary; }
From source file:com.opensymphony.xwork2.validator.AnnotationValidationConfigurationBuilder.java
private Date parseDateString(String value, String format) { SimpleDateFormat d0 = null;//w w w . j a v a2 s . c o m if (StringUtils.isNotEmpty(format)) { d0 = new SimpleDateFormat(format); } SimpleDateFormat d1 = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault()); SimpleDateFormat d2 = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.getDefault()); SimpleDateFormat d3 = (SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()); SimpleDateFormat[] dfs = (d0 != null ? new SimpleDateFormat[] { d0, d1, d2, d3 } : new SimpleDateFormat[] { d1, d2, d3 }); for (SimpleDateFormat df : dfs) try { Date check = df.parse(value); if (check != null) { return check; } } catch (ParseException ignore) { } return null; }
From source file:DDTDate.java
/** * Creates the output the user indicated in the input (outputType component) subject to the requested style (outputStyle) component * @return//from ww w . j a va2s . co m */ private String createOutput() { String result = ""; try { // If needed, adjust the reference date by the number and type of units specified - as per the time zone if (getUnits() != 0) { //setReferenceDate(getReferenceDateAdjustedForTimeZone()); getReferenceDate().add(getDurationType(), getUnits()); } // Create date formatters to be used for all varieties - the corresponding date variables are always set for convenience purposes DateFormat shortFormatter = DateFormat.getDateInstance(DateFormat.SHORT); DateFormat mediumFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM); DateFormat longFormatter = DateFormat.getDateInstance(DateFormat.LONG); DateFormat fullFormatter = DateFormat.getDateInstance(DateFormat.FULL); // Build the specific formatter specified DateFormat formatter = null; switch (getOutputStyle().toLowerCase()) { case "medium": { formatter = mediumFormatter; break; } case "long": { formatter = longFormatter; break; } case "full": { formatter = fullFormatter; break; } default: formatter = shortFormatter; } // output style switch // construct the specified result - one at a time MutableDateTime theReferenceDate = getReferenceDate(); //getReferenceDateAdjustedForTimeZone(); switch (getOutputType().toLowerCase()) { case "date": { result = formatter.format(theReferenceDate.toDate()); break; } case "time": { switch (getOutputStyle().toLowerCase()) { case "short": { result = theReferenceDate.toString("hh:mm:ss"); break; } default: result = theReferenceDate.toString("hh:mm:ss.SSS"); } break; } // separate time components case "hour": case "minute": case "second": case "hour24": { String tmp = theReferenceDate.toString("hh:mm:ss"); if (tmp.toString().contains(":")) { String[] hms = split(tmp.toString(), ":"); if (hms.length > 2) { switch (getOutputType().toLowerCase()) { case "hour": { // Hour - '12' result = hms[0]; break; } case "minute": { // Minutes - '34' result = hms[1]; break; } case "second": { // Second - '56' result = hms[2]; break; } case "hour24": { // Hour - '23' result = theReferenceDate.toString("HH"); break; } default: result = hms[0]; } // switch for individual time component } // three parts of time components } // timestamp contains separator ":" break; } // Hours, Minutes, Seconds case "year": { switch (getOutputStyle().toLowerCase()) { case "short": { result = theReferenceDate.toString("yy"); break; } default: result = theReferenceDate.toString("yyyy"); } break; } case "month": { switch (getOutputStyle().toLowerCase()) { case "short": { result = theReferenceDate.toString("M"); break; } case "medium": { // padded with 0 result = theReferenceDate.toString("MM"); break; } case "long": { // short name 'Feb' result = theReferenceDate.toString("MMM"); break; } default: // Full name 'September' result = theReferenceDate.toString("MMMM"); } break; } case "day": { switch (getOutputStyle().toLowerCase()) { case "short": { result = theReferenceDate.toString("d"); break; } case "medium": { result = theReferenceDate.toString("dd"); break; } default: result = theReferenceDate.toString("dd"); } } case "doy": { result = theReferenceDate.toString("D"); break; } case "dow": { switch (getOutputStyle().toLowerCase()) { case "short": { result = theReferenceDate.toString("E"); break; } case "medium": { DateTime dt = new DateTime(theReferenceDate.toDate()); DateTime.Property dowDTP = dt.dayOfWeek(); result = dowDTP.getAsText(); break; } default: result = theReferenceDate.toString("E"); } break; } // day of week case "zone": { result = theReferenceDate.toString("zzz"); break; } case "era": { result = theReferenceDate.toString("G"); break; } case "ampm": { result = theReferenceDate.toString("a"); break; } default: { setException("Invalid Output Unit - cannot set output"); } // Create full date variables for the short, medium, long, full styles } // output type switch } // try constructing result catch (Exception e) { setException(e); } finally { return result; } }
From source file:gov.opm.scrd.batchprocessing.jobs.BatchProcessingJob.java
/** * Import lock box files./*w w w . j a va 2 s .c o m*/ * * @param now The current date. * @param isNowHoliday Indicate whether current is holiday * @return true if execution is successful; false to retry. * @throws BatchProcessingException If major error occurred. */ private boolean importFiles(Date now, boolean isNowHoliday) throws BatchProcessingException { StringBuilder procMessage = new StringBuilder(); procMessage.append("Service Credit Batch started at "); procMessage.append(DateFormat.getTimeInstance(DateFormat.LONG, Locale.US).format(now)); procMessage.append(" on "); procMessage.append(DateFormat.getDateInstance(DateFormat.LONG, Locale.US).format(now)); procMessage.append(". Batch done at @#$%EndingTime%$#@."); procMessage.append(CRLF).append(CRLF); File inputDirectory = new File(inputDirectoryPath); if (!inputDirectory.exists() || !inputDirectory.isDirectory() || !inputDirectory.canRead()) { logger.error("Can not read folder: " + inputDirectory); procMessage.append("THE NETWORK IS DOWN! "); procMessage.append(CRLF); procMessage.append("Network Services not Available for Service Credit. Cannot access the "); procMessage.append(inputDirectoryPath); procMessage.append(" network folder. Please ask the Help Desk to investigate. "); procMessage.append("SERVICE CREDIT IS SHUT DOWN UNTIL THIS ERROR IS FIXED! "); notifyByEmail(procMessage.toString(), "SERVICE CREDIT BATCH CANNOT ACCESS NETWORK", "Testing Network"); auditError("SERVICE CREDIT BATCH CANNOT ACCESS NETWORK", procMessage.toString()); return false; } // Filter the input lockbox files final String regex = wildCardInput.replace("?", ".?").replace("*", ".*?"); File[] inputFiles = inputDirectory.listFiles(new FileFilter() { @Override public boolean accept(File inputFile) { if (inputFile.getName().matches(regex)) { if (inputFile.isFile() && inputFile.canRead() && inputFile.canWrite()) { return true; } logger.warn("Does not have read/write permission to file: " + inputFile); } return false; } }); if (inputFiles.length == 0) { if (!isNowHoliday && Boolean.TRUE != todayAuditBatch.getFileReceived()) { logger.error("No files arrived today in: " + inputDirectory); procMessage.append("Today's Lockbox Bank File has not arrived. Please notify Production Control" + " and BSG that the data file is not in the "); procMessage.append(inputDirectoryPath); procMessage.append(" network share. The nightly batch process is scheduled to run at "); procMessage.append(DateFormat.getTimeInstance(DateFormat.LONG, Locale.US).format(now)); procMessage.append(" and today's import should run before that time. "); notifyByEmail(procMessage.toString(), "SERVICE CREDIT LOCKBOX FILE IS LATE!", "ERROR"); auditError("SERVICE CREDIT LOCKBOX FILE IS LATE!", procMessage.toString()); return false; } return true; } // Mark file arrived if (Boolean.TRUE != todayAuditBatch.getFileReceived()) { todayAuditBatch.setFileReceived(true); try { todayAuditBatch = mergeEntity(todayAuditBatch); } catch (PersistenceException pe) { throw new BatchProcessingException( "Database error while updating audit batch log when importing files", pe); } } // Import files logger.info("Start importing files in: " + inputDirectory); for (File inputFile : inputFiles) { if (!inputFile.exists() || !inputFile.isFile() || !inputFile.canRead()) { // Just make sure logger.warn("Lockbox file is not a readable file: " + inputFile); continue; } importFile(procMessage, inputFile); } logger.info("End importing files in: " + inputDirectory); return true; }