use of edu.cornell.kfs.sys.util.CuSqlChunk in project cu-kfs by CU-CommunityApps.
the class DocumentMaintenanceDaoJdbc method buildRequeueSqlQueryChunk.
private CuSqlChunk buildRequeueSqlQueryChunk(boolean includeOrderByClause) {
Collection<String> docTypeIds = findNonRequeueableDocumentTypes();
Collection<String> roleIds = findRequeueableRoleIds();
CuSqlChunk subQuery = CuSqlChunk.of("SELECT DH.DOC_HDR_ID FROM KFS.KREW_DOC_HDR_T DH ", "WHERE DH.DOC_HDR_STAT_CD = ", CuSqlChunk.forParameter(KewApiConstants.ROUTE_HEADER_ENROUTE_CD), " AND DH.DOC_TYP_ID NOT IN (", CuSqlChunk.forStringParameters(docTypeIds), ")", " AND EXISTS (", "SELECT DISTINCT RQ.DOC_HDR_ID FROM KFS.KREW_ACTN_RQST_T RQ ", "WHERE DH.DOC_HDR_ID = RQ.DOC_HDR_ID ", "AND RQ.RSP_ID IN (", "SELECT RR.RSP_ID FROM KFS.KRIM_ROLE_RSP_T RR ", "WHERE RR.ROLE_ID IN (", CuSqlChunk.forStringParameters(roleIds), ")))");
if (includeOrderByClause) {
subQuery.append(" ORDER BY DH.DOC_HDR_ID ASC");
}
return subQuery;
}
Aggregations