List of usage examples for java.util Date toString
public String toString()
where:dow mon dd hh:mm:ss zzz yyyy
From source file:FolderModel.java
protected String[] getCachedData(int row) { if (cached[row] == null) { try {/*w ww . j a v a 2 s . c o m*/ Message m = messages[row]; String[] theData = new String[4]; // Date Date date = m.getSentDate(); if (date == null) { theData[0] = "Unknown"; } else { theData[0] = date.toString(); } // From Address[] adds = m.getFrom(); if (adds != null && adds.length != 0) { theData[1] = adds[0].toString(); } else { theData[1] = ""; } // Subject String subject = m.getSubject(); if (subject != null) { theData[2] = subject; } else { theData[2] = "(No Subject)"; } cached[row] = theData; } catch (MessagingException e) { e.printStackTrace(); } } return cached[row]; }
From source file:io.milton.cloud.server.apps.calendar.CalendarManager.java
private void appendLine(Date d, OutputStream out) { try {/*from w w w .ja va2s. co m*/ out.write(d.toString().getBytes()); out.write("\n".getBytes()); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:org.jpos.gl.rule.CanPost.java
private void checkEntries(GLTransaction txn, Date postDate) throws GLException { List list = txn.getEntries(); Iterator iter = list.iterator(); while (iter.hasNext()) { GLEntry entry = (GLEntry) iter.next(); Account acct = entry.getAccount(); Date end = acct.getExpiration(); if (end != null && postDate.compareTo(end) > 0) { throw new GLException("Account '" + acct.toString() + "' cannot accept transactions with a post date greater than " + end.toString()); }//from w w w .jav a 2 s. c om } }
From source file:org.devware.batch.validator.ItemValidator.java
/** * Effecture le controle sur le date d une personne. * Le model ici etant constitu de la classe personne * L objet errors en parametre comporte des erreurs * Ces erreurs seront utilis par le processeur: les ligne errone sont * pas traites par ce dernier//from w ww. j ava 2 s . c om * * @param date Le nom valider de la personne * @param errors L' objet erreur comportant les erreurs * @see ValidatingItemProcessor */ protected void validateDate(Date date, Errors errors) { // on verifie si la date est null if (date == null) { errors.rejectValue("Personne.date", "error.null.date"); } // on verifie le format de la date if (date != null && !date.toString().matches("[a-zA-Z]+")) { errors.rejectValue("Personne.date", "error.format.date"); } }
From source file:MessageViewer.java
protected void loadHeaders() { // setup what we want in our viewer StringBuffer sb = new StringBuffer(); // date//from w w w . j ava 2 s . c o m sb.append("Date: "); try { Date duh = displayed.getSentDate(); if (duh != null) { sb.append(duh.toString()); } else { sb.append("Unknown"); } sb.append("\n"); // from sb.append("From: "); Address[] adds = displayed.getFrom(); if (adds != null && adds.length > 0) { sb.append(adds[0].toString()); } sb.append("\n"); // to sb.append("To: "); adds = displayed.getRecipients(Message.RecipientType.TO); if (adds != null && adds.length > 0) { sb.append(adds[0].toString()); } sb.append("\n"); // subject sb.append("Subject: "); sb.append(displayed.getSubject()); headers.setText(sb.toString()); } catch (MessagingException me) { headers.setText(""); } }
From source file:org.intermine.dwr.TrackAjaxServices.java
/** * @param timeRange The time range to search within. * @return The query tracks in that time-range. *///from w ww .j a v a 2 s . c o m public List<Object[]> getQueryTracksDataTable(String timeRange) { Date startTimeRange = calculateDate(timeRange); String timeStampConstraint = " timestamp > '" + startTimeRange.toString() + "' "; String sql = "SELECT type, COUNT(type)," + " (SELECT COUNT(*) FROM (SELECT username FROM querytrack WHERE username!=''" + " AND type=qt.type AND" + timeStampConstraint + " GROUP BY username) AS querysubselect)," + " (SELECT COUNT(*) FROM (SELECT sessionidentifier FROM querytrack" + " WHERE username='' AND type=qt.type AND" + timeStampConstraint + " GROUP BY sessionidentifier) AS querysubselect2)" + " FROM querytrack AS qt WHERE qt.timestamp > '" + startTimeRange.toString() + "'" + " GROUP BY qt.type ORDER BY COUNT(type) DESC LIMIT 20"; return getTracksDataTable(sql); }
From source file:org.intermine.dwr.TrackAjaxServices.java
/** * @param timeRange The time range to search within. * @return The list search tracks in that time-range. *//* w w w . jav a 2 s .c o m*/ public List<Object[]> getSearchTracksDataTable(String timeRange) { Date startTimeRange = calculateDate(timeRange); String timeStampConstraint = " timestamp > '" + startTimeRange.toString() + "'"; String sql = "SELECT keyword, COUNT(keyword)," + " (SELECT COUNT(*) FROM (SELECT username FROM searchtrack WHERE username!=''" + " AND keyword=st.keyword AND" + timeStampConstraint + "GROUP BY username) AS searchsubselect)," + " (SELECT COUNT(*) FROM (SELECT sessionidentifier FROM searchtrack" + " WHERE username='' AND keyword=st.keyword AND" + timeStampConstraint + "GROUP BY sessionidentifier) AS searchsubselect2)" + " FROM searchtrack AS st WHERE st.timestamp > '" + startTimeRange.toString() + "'" + " GROUP BY st.keyword ORDER BY COUNT(keyword) DESC LIMIT 50"; return getTracksDataTable(sql); }
From source file:org.intermine.dwr.TrackAjaxServices.java
/** * @param timeRange The time range to search within. * @return The template tracks in that time-range. *///from w ww. j a v a 2 s .c o m public List<Object[]> getTemplateTracksPercentage(String timeRange) { Date startTimeRange = calculateDate(timeRange); String timeStampConstraint = " timestamp > '" + startTimeRange.toString() + "'"; String sql = "SELECT templatename, COUNT(templatename)," + " (SELECT COUNT(*) FROM (SELECT username FROM templatetrack WHERE username!='' " + "AND templatename=tt.templatename AND" + timeStampConstraint + "GROUP BY username) AS templatesubselect)," + " (SELECT COUNT(*) FROM (SELECT sessionidentifier FROM templatetrack" + " WHERE username='' AND templatename=tt.templatename AND" + timeStampConstraint + " GROUP BY sessionidentifier) " + "AS templatesubselect2)" + " FROM templatetrack AS tt WHERE tt.timestamp > '" + startTimeRange.toString() + "'" + " GROUP BY tt.templatename ORDER BY COUNT(templatename) DESC LIMIT 20"; return getTracksDataTable(sql); }
From source file:org.intermine.dwr.TrackAjaxServices.java
/** * @param timeRange The time range to search within. * @return The list execution tracks in that time-range. */// w ww . ja v a2 s .c o m public List<Object[]> getListExecutionTracksDataTable(String timeRange) { Date startTimeRange = calculateDate(timeRange); String timeStampConstraint = " timestamp > '" + startTimeRange.toString() + "'"; String sql = "SELECT type, COUNT(type)," + " (SELECT COUNT(*) FROM (SELECT username FROM listtrack WHERE username!=''" + " AND event='EXECUTION' AND type=lt.type AND" + timeStampConstraint + "GROUP BY username) AS listsubselect)," + " (SELECT COUNT(*) FROM (SELECT sessionidentifier FROM listtrack" + " WHERE username='' AND event='EXECUTION'" + " AND type=lt.type AND" + timeStampConstraint + "GROUP BY sessionidentifier) AS listsubselect2)" + " FROM listtrack AS lt WHERE lt.timestamp > '" + startTimeRange.toString() + "'" + " AND lt.event='EXECUTION' GROUP BY lt.type ORDER BY COUNT(type) DESC LIMIT 20"; return getTracksDataTable(sql); }
From source file:org.intermine.dwr.TrackAjaxServices.java
/** * @param timeRange The time range to search within. * @return The list creation tracks in that time-range. *//*from ww w . j av a 2 s. com*/ public List<Object[]> getListCreationTracksDataTable(String timeRange) { Date startTimeRange = calculateDate(timeRange); String timeStampConstraint = " timestamp > '" + startTimeRange.toString() + "'"; String sql = "SELECT type, COUNT(type)," + " (SELECT COUNT(*) FROM (SELECT username FROM listtrack WHERE username!=''" + " AND event='CREATION' AND type=lt.type AND" + timeStampConstraint + "GROUP BY username) AS listsubselect)," + " (SELECT COUNT(*) FROM (SELECT sessionidentifier FROM listtrack" + " WHERE username='' AND event='CREATION'" + " AND type=lt.type AND" + timeStampConstraint + " GROUP BY sessionidentifier) AS listsubselect2)" + " FROM listtrack AS lt WHERE lt.timestamp > '" + startTimeRange.toString() + "'" + " AND lt.event='CREATION' GROUP BY lt.type ORDER BY COUNT(type) DESC LIMIT 20"; return getTracksDataTable(sql); }