@Override public void DocumentsRoutedReport(Stats stats, Date begDate, Date endDate) throws SQLException, LookupException { Query query = entityManager.createQuery( "select count(*) as count, drhv.docRouteStatus from DocumentRouteHeaderValue drhv where drhv.createDate between :beginDate and :endDate group by docRouteStatus"); // Query query = entityManager.createNamedQuery("Stats.DocumentsRoutedReport"); query.setParameter("beginDate", new Timestamp(begDate.getTime())); query.setParameter("endDate", new Timestamp(endDate.getTime())); @SuppressWarnings("unchecked") List<Object[]> resultList = query.getResultList(); for (Object[] result : resultList) { String actionType = result[1].toString(); String number = result[0].toString(); if (actionType.equals(KEWConstants.ROUTE_HEADER_CANCEL_CD)) { stats.setCanceledNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_DISAPPROVED_CD)) { stats.setDisapprovedNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_ENROUTE_CD)) { stats.setEnrouteNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_EXCEPTION_CD)) { stats.setExceptionNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_FINAL_CD)) { stats.setFinalNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_INITIATED_CD)) { stats.setInitiatedNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_PROCESSED_CD)) { stats.setProcessedNumber(number); } else if (actionType.equals(KEWConstants.ROUTE_HEADER_SAVED_CD)) { stats.setSavedNumber(number); } } }
@Override public void NumActiveItemsReport(Stats stats) throws SQLException, LookupException { stats.setNumActionItems( entityManager .createQuery("select count(*) from ActionItem ai") .getSingleResult() .toString()); // // stats.setNumActionItems(entityManager.createNamedQuery("Stats.NumActiveItemsReport").getSingleResult().toString()); }
@Override public void NumUsersReport(Stats stats) throws SQLException, LookupException { stats.setNumUsers( entityManager .createQuery("select count(distinct uo.workflowId) from UserOptions uo") .getSingleResult() .toString()); // // stats.setNumUsers(entityManager.createNamedQuery("Stats.NumUsersReport").getSingleResult().toString()); }
@Override public void NumberOfDocTypesReport(Stats stats) throws SQLException, LookupException { stats.setNumDocTypes( entityManager .createQuery("select count(*) from DocumentType dt where dt.currentInd = true") .getSingleResult() .toString()); // // stats.setNumDocTypes(entityManager.createNamedQuery("Stats.NumberOfDocTypesReport").getSingleResult().toString()); }
@Override public void NumInitiatedDocsByDocTypeReport(Stats stats) throws SQLException, LookupException { Query query = entityManager.createQuery( "select count(*), dt.name from DocumentRouteHeaderValue drhv, DocumentType dt where drhv.createDate > :createDate and drhv.documentTypeId = dt.documentTypeId group by dt.name"); // Query query = entityManager.createNamedQuery("Stats.NumInitiatedDocsByDocTypeReport"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -29); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); query.setParameter("createDate", new Timestamp(calendar.getTime().getTime())); @SuppressWarnings("unchecked") List<Object[]> resultList = query.getResultList(); List<KeyValue> numDocs = new ArrayList<KeyValue>(resultList.size()); for (Object[] result : resultList) { numDocs.add(new ConcreteKeyValue(result[1].toString(), result[0].toString())); } stats.setNumInitiatedDocsByDocType(numDocs); }