use of org.hisp.dhis.util.DateUtils.getLongDateString in project dhis2-core by dhis2.
the class JdbcEventAnalyticsTableManager method populateTable.
@Override
protected void populateTable(AnalyticsTableUpdateParams params, AnalyticsTablePartition partition) {
final Program program = partition.getMasterTable().getProgram();
final String start = DateUtils.getLongDateString(partition.getStartDate());
final String end = DateUtils.getLongDateString(partition.getEndDate());
final String partitionClause = partition.isLatestPartition() ? "and psi.lastupdated >= '" + start + "' " : "and psi.executiondate >= '" + start + "' and psi.executiondate < '" + end + "' ";
String fromClause = "from programstageinstance psi " + "inner join programinstance pi on psi.programinstanceid=pi.programinstanceid " + "inner join programstage ps on psi.programstageid=ps.programstageid " + "inner join program pr on pi.programid=pr.programid and pi.deleted is false " + "inner join categoryoptioncombo ao on psi.attributeoptioncomboid=ao.categoryoptioncomboid " + "left join trackedentityinstance tei on pi.trackedentityinstanceid=tei.trackedentityinstanceid " + "and tei.deleted is false " + "inner join organisationunit ou on psi.organisationunitid=ou.organisationunitid " + "left join _orgunitstructure ous on psi.organisationunitid=ous.organisationunitid " + "left join _organisationunitgroupsetstructure ougs on psi.organisationunitid=ougs.organisationunitid " + "and (cast(date_trunc('month', psi.executiondate) as date)=ougs.startdate or ougs.startdate is null) " + "inner join _categorystructure acs on psi.attributeoptioncomboid=acs.categoryoptioncomboid " + "left join _dateperiodstructure dps on cast(psi.executiondate as date)=dps.dateperiod " + "where psi.lastupdated < '" + getLongDateString(params.getStartTime()) + "' " + partitionClause + "and pr.programid=" + program.getId() + " " + "and psi.organisationunitid is not null " + "and psi.executiondate is not null " + "and psi.deleted is false ";
populateTableInternal(partition, getDimensionColumns(program), fromClause);
}
Aggregations