protected static String formatDate( Date date ) { return DateUtils.getMediumDateString( date ); } }
/** * Returns a string indicating when the grid was generated. */ private static String getGeneratedString() { return "Generated: " + DateUtils.getMediumDateString(); }
/** * Formats the current Date to the format YYYY-MM-DD. * * @return A formatted date string. */ public static String getMediumDateString() { return getMediumDateString( Calendar.getInstance().getTime() ); }
"cast(round(cast(sum(datavalues) as numeric),0) as int) as savedDataValues," + "max(users) as users from datastatistics " + "where created >= '" + DateUtils.getMediumDateString( start ) + "' " + "and created <= '" + DateUtils.getMediumDateString( end ) + "' ";
public static void setDefaultFooterOnDocument( Document document, String serverName, Font font ) { String strFooterText = String.format( FOOTERTEXT_DEFAULT, serverName, DateUtils.getMediumDateString() ); setFooterOnDocument( document, strFooterText, font ); }
private List<Integer> getDataYears( Date earliest ) { String sql = "select distinct(extract(year from pe.startdate)) " + "from completedatasetregistration cdr " + "inner join period pe on cdr.periodid=pe.periodid " + "where pe.startdate is not null "; if ( earliest != null ) { sql += "and pe.startdate >= '" + DateUtils.getMediumDateString( earliest ) + "'"; } return jdbcTemplate.queryForList( sql, Integer.class ); }
private List<Integer> getDataYears( Date earliest ) { String sql = "select distinct(extract(year from pe.startdate)) " + "from validationresult vrs " + "inner join period pe on vrs.periodid=pe.periodid " + "where pe.startdate is not null "; if ( earliest != null ) { sql += "and pe.startdate >= '" + DateUtils.getMediumDateString( earliest ) + "'"; } return jdbcTemplate.queryForList( sql, Integer.class ); }
private List<Integer> getDataYears( Date earliest ) { String sql = "select distinct(extract(year from pe.startdate)) " + "from datavalue dv " + "inner join period pe on dv.periodid=pe.periodid " + "where pe.startdate is not null "; if ( earliest != null ) { sql += "and pe.startdate >= '" + DateUtils.getMediumDateString( earliest ) + "'"; } return jdbcTemplate.queryForList( sql, Integer.class ); }
public String[] getPeriodTitles( List<Period> periods, I18nFormat format ) { String[] periodTitles = new String[periods.size()]; for ( int i = 0; i < periods.size(); i++ ) { Period period = periods.get( i ); periodTitles[i] = format.formatPeriod( period ); periodTitles[i] += " - " + DateUtils.getMediumDateString( period.getStartDate() ) + " - " + DateUtils.getMediumDateString( period.getEndDate() ); } return periodTitles; }
@Override protected List<String> getPartitionChecks( AnalyticsTablePartition partition ) { return Lists.newArrayList( "yearly = '" + partition.getYear() + "'", "executiondate >= '" + DateUtils.getMediumDateString( partition.getStartDate() ) + "'", "executiondate < '" + DateUtils.getMediumDateString( partition.getEndDate() ) + "'" ); }
@Override protected List<String> getPartitionChecks( AnalyticsTablePartition partition ) { return newArrayList( "year = " + partition.getYear() + "", "pestartdate < '" + DateUtils.getMediumDateString( partition.getEndDate() ) + "'" ); }
private List<Integer> getDataYears( Program program, Date earliest ) { String sql = "select distinct(extract(year from psi.executiondate)) " + "from programstageinstance psi " + "inner join programinstance pi on psi.programinstanceid = pi.programinstanceid " + "where pi.programid = " + program.getId() + " " + "and psi.executiondate is not null " + "and psi.deleted is false "; if ( earliest != null ) { sql += "and psi.executiondate >= '" + DateUtils.getMediumDateString( earliest ) + "'"; } return jdbcTemplate.queryForList( sql, Integer.class ); } }
value = DateUtils.getMediumDateString( programStageInstance.getDueDate() ); value = DateUtils.getMediumDateString( programStageInstance.getExecutionDate() );
private static String createPeriodClause( ExportParams params, ImmutableMap.Builder<String, String> namedParamsBuilder ) { if ( params.hasStartEndDate() ) { namedParamsBuilder .put( "startDate", DateUtils.getMediumDateString( params.getStartDate() ) ) .put( "endDate", DateUtils.getMediumDateString( params.getEndDate() ) ); return " AND ( pe.startdate >= '${startDate}' AND pe.enddate <= '${endDate}' ) "; } else if ( params.hasPeriods() ) { namedParamsBuilder .put( "periods", commaDelimitedIds( params.getPeriods() ) ); return " AND cdsr.periodid in ( ${periods} ) "; } return ""; }
public static String serialize( Period period ) { return DateUtils.getMediumDateString( period.getStartDate() ) + "/" + period.getPeriodType().getIso8601Duration(); } }
/** * Generates a sub query which provides a view of the data where each row is * ranked by the start date, then end date of the data value period, latest first. * The data is partitioned by data element, org unit, category option combo and * attribute option combo. A column {@code pe_rank} defines the rank. Only data * for the last 10 years relative to the period end date is included. */ private String getLastValueSubquerySql( DataQueryParams params ) { Date latest = params.getLatestEndDate(); Date earliest = addYears( latest, LAST_VALUE_YEARS_OFFSET ); List<String> columns = getLastValueSubqueryQuotedColumns( params ); String fromSourceClause = getFromSourceClause( params ) + " as " + ANALYTICS_TBL_ALIAS; String sql = "(select "; for ( String col : columns ) { sql += col + ","; } sql += "row_number() over (" + "partition by dx, ou, co, ao " + "order by peenddate desc, pestartdate desc) as pe_rank " + "from " + fromSourceClause + " " + "where pestartdate >= '" + getMediumDateString( earliest ) + "' " + "and pestartdate <= '" + getMediumDateString( latest ) + "' " + "and (value is not null or textvalue is not null))"; return sql; }
/** * Generates a sub query which provides a view of the data where each row is * ranked by the execution date, latest first. The events are partitioned by * org unit and attribute option combo. A column {@code pe_rank} defines the rank. * Only data for the last 10 years relative to the period end date is included. */ private String getLastValueSubquerySql( EventQueryParams params ) { Assert.isTrue( params.hasValueDimension(), "Last value aggregation type query must have value dimension" ); Date latest = params.getLatestEndDate(); Date earliest = addYears( latest, LAST_VALUE_YEARS_OFFSET ); String valueItem = quote( params.getValue().getDimensionItem() ); List<String> columns = getLastValueSubqueryQuotedColumns( params ); String alias = getPeriodAlias( params ); String timeCol = quote( alias, params.getTimeFieldAsFieldFallback() ); String sql = "(select "; for ( String col : columns ) { sql += col + ","; } sql += "row_number() over (" + "partition by ou, ao " + "order by " + timeCol + " desc) as pe_rank " + "from " + params.getTableName() + " " + "where " + timeCol + " >= '" + getMediumDateString( earliest ) + "' " + "and " + timeCol + " <= '" + getMediumDateString( latest ) + "' " + "and " + valueItem + " is not null)"; return sql; }
summary.setDataSetComplete( DateUtils.getMediumDateString( completeDate ) );
private String getEventStatusWhereClause( TrackedEntityInstanceQueryParams params ) String start = getMediumDateString( params.getEventStartDate() ); String end = getMediumDateString( params.getEventEndDate() );
final String start = DateUtils.getMediumDateString( partition.getStartDate() ); final String end = DateUtils.getMediumDateString( partition.getEndDate() ); final String tableName = partition.getTempTableName();