Esri Geoportal Server
1.2.9

com.esri.gpt.server.usage.harvester
Class HarvesterStatisticsDao

java.lang.Object
  extended by com.esri.gpt.framework.sql.BaseDao
      extended by com.esri.gpt.server.usage.harvester.HarvesterStatisticsDao

public class HarvesterStatisticsDao
extends BaseDao

Harvester statistics data access object.


Constructor Summary
HarvesterStatisticsDao(ResponseWriter writer)
          Creates instance of the DAO.
 
Method Summary
protected  HashMap<String,String> collectSitesByProtocolType(HashMap<String,Object> protocolMap)
          Collect docuuid of sites on a schedule by protocol type
protected  String createCountCompletedSQL(int timePeriod)
          Creates Select SQL to count completed jobs.
protected  String createCountOfApprovedSites()
          Create sql to fetch count of approved sites
protected  String createCountOfApprovedSitesByProtocol()
          Create sql to fetch count of approved sites by protocol
protected  String createCountOfApprovedSitesOnSchedule()
          Create sql to fetch count of approved sites that are on a schedule
protected  String createCountOfApprovedSitesOnScheduleByProtocol()
          Create sql to fetch count of approved sites on a schedule by protocol
protected  String createCountOfRegisteredSites()
          Create sql to fetch count of registered sites
protected  String createCountOfRegisteredSitesByProtocol()
          Create sql to fetch count of registered sites by protocol
protected  String createCountPendingSQL(int timePeriod)
          Creates Select SQL to count jobs with 'Running' or 'submitted' statuses.
protected  String createCountPendingSQLByStatus()
          Creates Select SQL to count jobs grouped by 'Running' or 'submitted' statuses.
protected  String createDocumentCount()
          Create sql to fetch published document count for a site.
protected  String createHistoryCountsSQL(int timePeriod)
          Creates Select SQL to count harvesting history table
protected  String createSelectCompletedSQL(String uuids, String startDate, String endDate)
          Creates Select SQL to select complete jobs based on criteria.
protected  String createSelectHistorySQL(String uuids, String startDate, String endDate)
          Creates Select SQL to fetch rows harvesting history table based on constraints.
protected  String createSelectPendingSQL(String uuids, String startDate, String endDate)
          Creates Select SQL to select pending jobs based on criteria.
protected  void fetchCompleted(String sql, String uuids, String startDate, String endDate)
          Fetches information from harvesting complete table
protected  int fetchCountByTime(String sql, int timePeriod)
          Fetch count of records using given sql and timeperiod
protected  void fetchDocumentCountByProtocol(HashMap<String,Object> protocolMap, HashMap<String,String> docuuidMap)
          Fetches published document count grouped by protocol type
protected  int[] fetchHarvestCounts(int timePeriod)
          This method is used to fetch harvest counts for given number of days from current date
protected  void fetchHistory(String sql, String uuids, String startDate, String endDate)
          Fetches harvesting history information
protected  void fetchPending(String sql, String uuids, String startDate, String endDate)
          Fetches information from pending table.
protected  HashMap<String,Object> fetchRepositoriesSummaryByProtocol()
          Fetches repository summary information by protocol
protected  int[] fetchSummary()
          Fetches Summary information for web harvester
protected  String getHarvestingDataTableName()
          Gets the harvesting table name.
protected  String getHarvestingHistoryTableName()
          Gets harvesting history table name.
protected  String getHarvestingJobsCompletedTableName()
          Gets completed harvesting jobs table name.
protected  String getHarvestingJobTableName()
          Gets harvesting job table name.
protected  String getHarvestingTableName()
          Gets the harvesting table name.
protected  String getResourceTableName()
          Gets completed harvesting jobs table name.
protected  void populateProtocolInfo(HashMap<String,Object> protocolMap, String sql, String propertyName)
          Populates protocol info objects map using sql.
protected  String selectDistinctProtocols()
          Create sql to select distinct registered site protocols
 
Methods inherited from class com.esri.gpt.framework.sql.BaseDao
appendExpression, appendValueFilter, closeResultSet, closeStatement, getApplicationConfiguration, getIsDbCaseSensitive, getRequestContext, logExpression, returnConnection, setRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HarvesterStatisticsDao

public HarvesterStatisticsDao(ResponseWriter writer)
Creates instance of the DAO.

Parameters:
writer - response writer
Method Detail

createHistoryCountsSQL

protected String createHistoryCountsSQL(int timePeriod)
Creates Select SQL to count harvesting history table

Returns:
Select SQL

createSelectHistorySQL

protected String createSelectHistorySQL(String uuids,
                                        String startDate,
                                        String endDate)
Creates Select SQL to fetch rows harvesting history table based on constraints.

Returns:
Select SQL

createCountPendingSQLByStatus

protected String createCountPendingSQLByStatus()
Creates Select SQL to count jobs grouped by 'Running' or 'submitted' statuses.

Returns:
Select SQL

createCountPendingSQL

protected String createCountPendingSQL(int timePeriod)
Creates Select SQL to count jobs with 'Running' or 'submitted' statuses.

Returns:
Select SQL

createCountCompletedSQL

protected String createCountCompletedSQL(int timePeriod)
Creates Select SQL to count completed jobs.

Returns:
Select SQL

createSelectPendingSQL

protected String createSelectPendingSQL(String uuids,
                                        String startDate,
                                        String endDate)
Creates Select SQL to select pending jobs based on criteria.

Returns:
Select SQL

createSelectCompletedSQL

protected String createSelectCompletedSQL(String uuids,
                                          String startDate,
                                          String endDate)
Creates Select SQL to select complete jobs based on criteria.

Returns:
Select SQL

createCountOfRegisteredSites

protected String createCountOfRegisteredSites()
Create sql to fetch count of registered sites

Returns:
the sql string

createCountOfApprovedSites

protected String createCountOfApprovedSites()
Create sql to fetch count of approved sites

Returns:
the sql string

createCountOfApprovedSitesOnSchedule

protected String createCountOfApprovedSitesOnSchedule()
Create sql to fetch count of approved sites that are on a schedule

Returns:
the sql string

createCountOfApprovedSitesByProtocol

protected String createCountOfApprovedSitesByProtocol()
Create sql to fetch count of approved sites by protocol

Returns:
the sql string

createCountOfRegisteredSitesByProtocol

protected String createCountOfRegisteredSitesByProtocol()
Create sql to fetch count of registered sites by protocol

Returns:
the sql string

createCountOfApprovedSitesOnScheduleByProtocol

protected String createCountOfApprovedSitesOnScheduleByProtocol()
Create sql to fetch count of approved sites on a schedule by protocol

Returns:
the sql string

createDocumentCount

protected String createDocumentCount()
Create sql to fetch published document count for a site.

Returns:
the sql string

collectSitesByProtocolType

protected HashMap<String,String> collectSitesByProtocolType(HashMap<String,Object> protocolMap)
                                                     throws SQLException
Collect docuuid of sites on a schedule by protocol type

Parameters:
protocolMap - map of docuuid of sites on schedule and their corresponding protocol type
Returns:
docuuid map
Throws:
SQLException - if sql exception occurs

fetchCountByTime

protected int fetchCountByTime(String sql,
                               int timePeriod)
                        throws SQLException
Fetch count of records using given sql and timeperiod

Parameters:
sql - the sql query to execute
timePeriod - the number of days from current date
Returns:
count value
Throws:
SQLException - if sql exception occurs

fetchCompleted

protected void fetchCompleted(String sql,
                              String uuids,
                              String startDate,
                              String endDate)
                       throws Exception
Fetches information from harvesting complete table

Parameters:
sql - the sql query to execute
uuids - the uuids constraint
startDate - the start date constraint
endDate - the end date constraint
Throws:
Exception - if exception occurs

fetchDocumentCountByProtocol

protected void fetchDocumentCountByProtocol(HashMap<String,Object> protocolMap,
                                            HashMap<String,String> docuuidMap)
                                     throws SQLException
Fetches published document count grouped by protocol type

Parameters:
protocolMap - the protocol type object map
docuuidMap - the docuuid map of sites on schedule
Throws:
SQLException - if sql exception occurs

fetchHistory

protected void fetchHistory(String sql,
                            String uuids,
                            String startDate,
                            String endDate)
                     throws Exception
Fetches harvesting history information

Parameters:
sql - the sql query to execute
uuids - the uuids constraint
startDate - the start date constraint
endDate - the end date constraint
Throws:
Exception - if exception occurs

fetchPending

protected void fetchPending(String sql,
                            String uuids,
                            String startDate,
                            String endDate)
                     throws Exception
Fetches information from pending table.

Parameters:
sql - the sql query to execute
uuids - the uuids constraint
startDate - the start date constraint
endDate - the end date constraint
Throws:
Exception - if exception occurs

fetchHarvestCounts

protected int[] fetchHarvestCounts(int timePeriod)
                            throws Exception
This method is used to fetch harvest counts for given number of days from current date

Parameters:
timePeriod - the number days to aggregate for
Returns:
the counts array (harvestedCount,publishedCount,validatedCount)
Throws:
Exception - if exception occurs

fetchSummary

protected int[] fetchSummary()
                      throws Exception
Fetches Summary information for web harvester

Returns:
the active and submitted count for web harvest jobs from pending table
Throws:
Exception - if exception occurs

fetchRepositoriesSummaryByProtocol

protected HashMap<String,Object> fetchRepositoriesSummaryByProtocol()
                                                             throws Exception
Fetches repository summary information by protocol

Returns:
map of protocol info objects
Throws:
Exception - if exception occurs

getHarvestingTableName

protected String getHarvestingTableName()
Gets the harvesting table name.

Returns:
the harvesting table name

getHarvestingDataTableName

protected String getHarvestingDataTableName()
Gets the harvesting table name.

Returns:
the harvesting table name

getHarvestingHistoryTableName

protected String getHarvestingHistoryTableName()
Gets harvesting history table name.

Returns:
the harvesting history table name

getHarvestingJobTableName

protected String getHarvestingJobTableName()
Gets harvesting job table name.

Returns:
the harvesting job table name

getHarvestingJobsCompletedTableName

protected String getHarvestingJobsCompletedTableName()
Gets completed harvesting jobs table name.

Returns:
completed harvesting jobs table name

getResourceTableName

protected String getResourceTableName()
Gets completed harvesting jobs table name.

Returns:
completed harvesting jobs table name

populateProtocolInfo

protected void populateProtocolInfo(HashMap<String,Object> protocolMap,
                                    String sql,
                                    String propertyName)
                             throws SQLException
Populates protocol info objects map using sql.

Parameters:
protocolMap - the protocol map object
sql - the sql string
propertyName - the property name of protocol info object to populate count using sql
Throws:
SQLException - if sql exception occurs

selectDistinctProtocols

protected String selectDistinctProtocols()
Create sql to select distinct registered site protocols

Returns:
the sql string

Esri Geoportal Server
1.2.9

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.