diff --git a/build/build-config.yml b/build/build-config.yml index e088ee542ef..b8dca14c6e2 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -404,4 +404,17 @@ config: image-name: "service-request" dockerfile: "build/maven/Dockerfile" - work-dir: "core-services/service-request/src/main/resources/db" - image-name: "service-request-db" \ No newline at end of file + image-name: "service-request-db" + +# frontend + - name: builds/Core-Platform/accelerators/workbench-ui + build: + - work-dir: accelerators/frontend/micro-ui/ + dockerfile: accelerators/frontend/micro-ui/web/docker/Dockerfile + image-name: workbench-ui + + - name: builds/Core-Platform/accelerators/digit-ui + build: + - work-dir: accelerators/frontend/micro-ui/ + dockerfile: accelerators/frontend/micro-ui/web/docker/Dockerfile + image-name: digit-ui \ No newline at end of file diff --git a/core-services/egov-searcher/pom.xml b/core-services/egov-searcher/pom.xml index 8dc135dda3a..a6ff48e3fe9 100644 --- a/core-services/egov-searcher/pom.xml +++ b/core-services/egov-searcher/pom.xml @@ -38,12 +38,12 @@ org.egov.services services-common - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.egov enc-client - 2.0.3-SNAPSHOT + 2.0.4-SNAPSHOT org.webjars @@ -87,7 +87,7 @@ org.egov.services tracer - 2.1.0-SNAPSHOT + 2.1.2-SNAPSHOT org.projectlombok diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java index 06505b406a4..0d7772d2adf 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java @@ -1,7 +1,9 @@ package org.egov.wf.config; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.*; +import java.util.TimeZone; + +import javax.annotation.PostConstruct; + import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Autowired; @@ -11,8 +13,13 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import java.util.TimeZone; +import com.fasterxml.jackson.databind.ObjectMapper; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; @@ -84,7 +91,7 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM // Statelevel tenantId required for escalation - @Value("${egov.statelevel.tenantid}") + @Value("${state.level.tenant.id}") private String stateLevelTenantId; @Value("${egov.wf.escalation.batch.size}") diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/BusinessServiceRepository.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/BusinessServiceRepository.java index ad297e52929..d8aef419db2 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/BusinessServiceRepository.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/BusinessServiceRepository.java @@ -64,6 +64,7 @@ public List getBusinessServices(BusinessServiceSearchCriteria c criteria.setTenantId(null); List preparedStmtList = new ArrayList<>(); query = queryBuilder.getBusinessServices(criteria, preparedStmtList); + query = util.replaceSchemaPlaceholder(query, tenantId); List searchResults = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); if(CollectionUtils.isEmpty(searchResults)) @@ -150,7 +151,7 @@ public Map>> getRoleTenantAndStatusMapping(String } /** - * Returns all the avialable businessServices + * Returns all the available businessServices * @return */ private List getAllBusinessService(String tenantIdForState){ diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/V1/BusinessServiceRepositoryV1.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/V1/BusinessServiceRepositoryV1.java index 2908b3291c1..1e01c297f7b 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/V1/BusinessServiceRepositoryV1.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/V1/BusinessServiceRepositoryV1.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.wf.config.WorkflowConfig; import org.egov.wf.repository.querybuilder.BusinessServiceQueryBuilder; import org.egov.wf.repository.rowmapper.BusinessServiceRowMapper; @@ -41,6 +42,9 @@ public class BusinessServiceRepositoryV1 { @Autowired private WorkflowUtil workflowUtil; + + @Autowired + private MultiStateInstanceUtil multiStateInstanceUtil; @Autowired @@ -79,12 +83,14 @@ public List getBusinessServices(BusinessServiceSearchCriteria c List searchResults = new LinkedList<>(); if(!CollectionUtils.isEmpty(stateLevelBusinessServices)){ + BusinessServiceSearchCriteria stateLevelCriteria = new BusinessServiceSearchCriteria(); - stateLevelCriteria.setTenantId(criteria.getTenantId().split("\\.")[0]); + stateLevelCriteria.setTenantId(multiStateInstanceUtil.getStateLevelTenant(criteria.getTenantId())); stateLevelCriteria.setBusinessServices(stateLevelBusinessServices); List stateLevelPreparedStmtList = new ArrayList<>(); + query = queryBuilder.getBusinessServices(stateLevelCriteria, stateLevelPreparedStmtList); - workflowUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + query = workflowUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); searchResults.addAll(jdbcTemplate.query(query, stateLevelPreparedStmtList.toArray(), rowMapper)); } if(!CollectionUtils.isEmpty(tenantBusinessServices)){ @@ -93,7 +99,7 @@ public List getBusinessServices(BusinessServiceSearchCriteria c tenantLevelCriteria.setBusinessServices(tenantBusinessServices); List tenantLevelPreparedStmtList = new ArrayList<>(); query = queryBuilder.getBusinessServices(tenantLevelCriteria, tenantLevelPreparedStmtList); - workflowUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); + query = workflowUtil.replaceSchemaPlaceholder(query, criteria.getTenantId()); searchResults.addAll(jdbcTemplate.query(query, tenantLevelPreparedStmtList.toArray(), rowMapper)); } @@ -105,13 +111,13 @@ public List getBusinessServices(BusinessServiceSearchCriteria c * Creates map of roles vs tenantId vs List of status uuids from all the avialable businessServices * @return */ - @Cacheable(value = "roleTenantAndStatusesMapping") - public Map>> getRoleTenantAndStatusMapping(){ + @Cacheable(value = "roleTenantAndStatusesMapping", key = "#tenantIdForState") + public Map>> getRoleTenantAndStatusMapping(String tenantIdForState){ Map>> roleTenantAndStatusMapping = new HashMap(); - List businessServices = getAllBusinessService(); + List businessServices = getAllBusinessService(tenantIdForState); for(BusinessService businessService : businessServices){ @@ -164,11 +170,11 @@ public Map>> getRoleTenantAndStatusMapping(){ * Returns all the avialable businessServices * @return */ - private List getAllBusinessService(){ + private List getAllBusinessService(String tenantIdForState){ List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getBusinessServices(new BusinessServiceSearchCriteria(), preparedStmtList); - + query = workflowUtil.replaceSchemaPlaceholder(query, tenantIdForState); List businessServices = jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); List filterBusinessServices = filterBusinessServices((businessServices)); diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilder.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilder.java index e07cf2eaa1c..b84d768a911 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilder.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilder.java @@ -24,7 +24,7 @@ public class BusinessServiceQueryBuilder { " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime," + "ac.createdBy as ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy," + "ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active as ac_active " + - " {SCHEMA}.FROM eg_wf_businessService_v2 bs " + + " FROM {SCHEMA}.eg_wf_businessService_v2 bs " + INNER_JOIN + " {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId = bs.uuid " + LEFT_OUTER_JOIN + " {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilder.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilder.java index 614e349b531..146e83891a9 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilder.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilder.java @@ -1,11 +1,10 @@ package org.egov.wf.repository.querybuilder; -import org.apache.commons.lang3.StringUtils; +import java.util.List; + import org.egov.wf.web.models.EscalationSearchCriteria; import org.springframework.stereotype.Component; -import java.util.List; - @Component public class EscalationQueryBuilder { @@ -14,7 +13,7 @@ public class EscalationQueryBuilder { private static final String BASE_QUERY = "select businessId from (" + " SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number " + - " FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE rank_number = 1 "; + " FROM {SCHEMA}.eg_wfprocessinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE rank_number = 1 "; /** diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilder.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilder.java index 24fd31d4064..41ee957e6b6 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilder.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilder.java @@ -56,18 +56,18 @@ public WorkflowQueryBuilder(WorkflowConfig config) { private final String ORDERBY_CREATEDTIME = " ORDER BY result_offset.wf_createdTime DESC "; - private final String LATEST_RECORD = " pi.lastmodifiedTime IN (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 GROUP BY businessid) "; + private final String LATEST_RECORD = " pi.lastmodifiedTime IN (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 GROUP BY businessid) "; private static final String COUNT_WRAPPER = "select count(DISTINCT wf_id) from ({INTERNAL_QUERY}) as count"; private static final String COUNT_WRAPPER_ESCALATED = "select count(DISTINCT businessid) from ({INTERNAL_QUERY}) as count"; private static final String COUNT_WRAPPER_INBOX = " select count(DISTINCT id) from ({INTERNAL_QUERY}) as count" ; private static final String BASE_QUERY = "select businessId from (" + " SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number " + - " FROM eg_wf_processinstance_v2 "; + " FROM {SCHEMA}.eg_wf_processinstance_v2 "; private static final String RANK_WRAPPER = "SELECT wf.* , assg.assignee AS asg, " + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank " + - " FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN ({BASE_QUERY})"; + " FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN ({BASE_QUERY})"; private static final String FINAL_ESCALATED_QUERY ="SELECT businessid from ( {RANKED_QUERY} ) final WHERE outer_rank = 2 "; @@ -141,7 +141,7 @@ public String getProcessInstanceIds(ProcessInstanceSearchCriteria criteria, List if (!criteria.getHistory()) { with_query_builder.append(" pi_outer.lastmodifiedTime = (" + - "SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid = pi_outer.businessid and tenantid = ? " + + "SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid = pi_outer.businessid and tenantid = ? " + ") "); preparedStmtList.add(criteria.getTenantId()); } @@ -179,7 +179,7 @@ public String getProcessInstanceIds(ProcessInstanceSearchCriteria criteria, List } if(criteria.getAssignee()!=null){ - with_query_builder.append(" and id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? "); + with_query_builder.append(" and id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? "); preparedStmtList.add(criteria.getAssignee()); preparedStmtList.add(criteria.getTenantId()); } @@ -295,7 +295,7 @@ public String getInboxIdCount(ProcessInstanceSearchCriteria criteria, ArrayList< public String getInboxIdQuery(ProcessInstanceSearchCriteria criteria, List preparedStmtList, Boolean isPaginationRequired){ String with_query = WITH_CLAUSE + " pi_outer.lastmodifiedTime = (" + - "SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid = pi_outer.businessid and tenantid = ? " + + "SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid = pi_outer.businessid and tenantid = ? " + ") "; preparedStmtList.add(criteria.getTenantId()); @@ -305,12 +305,12 @@ public String getInboxIdQuery(ProcessInstanceSearchCriteria criteria, List statusesIrrespectiveOfTenant = criteria.getStatusesIrrespectiveOfTenant(); if (CollectionUtils.isEmpty(tenantSpecificStatus) && !CollectionUtils.isEmpty(statusesIrrespectiveOfTenant)) { - String clause = " AND ((id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?)" + + String clause = " AND ((id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?)" + " AND pi_outer.tenantid = ? ) {{OR_CLUASE_PLACEHOLDER}} )"; preparedStmtList.add(criteria.getAssignee()); @@ -336,7 +336,7 @@ else if(!config.getAssignedOnly() && !CollectionUtils.isEmpty(tenantSpecificStat with_query_builder.append(clause); } } else { - with_query_builder.append(" AND id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? "); + with_query_builder.append(" AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? "); preparedStmtList.add(criteria.getAssignee()); preparedStmtList.add(criteria.getTenantId()); } @@ -434,7 +434,7 @@ public String getInboxCount(ProcessInstanceSearchCriteria criteria, List String countQuery = null; if(statuCount) { - countQuery = "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ({INTERNAL_QUERY}) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq.PI_STATUS"; + countQuery = "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ({INTERNAL_QUERY}) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq.PI_STATUS"; countQuery = countQuery.replace("{INTERNAL_QUERY}", query); }else { @@ -471,7 +471,7 @@ private String addCountWrapper(String query){ public String getInboxApplicationsBusinessIdsQuery(ProcessInstanceSearchCriteria criteria, ArrayList preparedStmtList) { - StringBuilder query = new StringBuilder("SELECT DISTINCT businessid FROM eg_wf_processinstance_v2 "); + StringBuilder query = new StringBuilder("SELECT DISTINCT businessid FROM {SCHEMA}.eg_wf_processinstance_v2 "); if(!isNull(criteria.getTenantId())){ addClauseIfRequired(query, preparedStmtList); diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/MDMSService.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/MDMSService.java index aaad0921109..c1a7d7da420 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/MDMSService.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/MDMSService.java @@ -1,7 +1,25 @@ package org.egov.wf.service; -import com.jayway.jsonpath.JsonPath; +import static org.egov.wf.util.WorkflowConstants.JSONPATH_BUSINESSSERVICE_STATELEVEL; +import static org.egov.wf.util.WorkflowConstants.MDMS_AUTOESCALTION; +import static org.egov.wf.util.WorkflowConstants.MDMS_BUSINESSSERVICE; +import static org.egov.wf.util.WorkflowConstants.MDMS_COMMON_MASTERS; +import static org.egov.wf.util.WorkflowConstants.MDMS_MODULE_TENANT; +import static org.egov.wf.util.WorkflowConstants.MDMS_TENANTS; +import static org.egov.wf.util.WorkflowConstants.MDMS_WF_SLA_CONFIG; +import static org.egov.wf.util.WorkflowConstants.MDMS_WORKFLOW; +import static org.egov.wf.util.WorkflowConstants.SLOT_PERCENTAGE_PATH; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteria; import org.egov.mdms.model.MdmsCriteriaReq; @@ -9,14 +27,12 @@ import org.egov.wf.config.WorkflowConfig; import org.egov.wf.repository.ServiceRequestRepository; import org.egov.wf.util.WorkflowConstants; -import org.egov.wf.web.models.ProcessInstanceRequest; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; -import java.util.*; - -import static org.egov.wf.util.WorkflowConstants.*; +import com.jayway.jsonpath.JsonPath; @Service public class MDMSService { @@ -29,6 +45,10 @@ public class MDMSService { private Map stateLevelMapping; + @Autowired + private MultiStateInstanceUtil centralInstanceUtil; + + @Autowired public MDMSService(WorkflowConfig config, ServiceRequestRepository serviceRequestRepository, WorkflowConfig workflowConfig) { this.config = config; @@ -49,7 +69,6 @@ public void stateLevelMapping(){ Object mdmsData = getBusinessServiceMDMS(); List> configs = JsonPath.read(mdmsData,JSONPATH_BUSINESSSERVICE_STATELEVEL); - for (Map map : configs){ String businessService = (String) map.get("businessService"); @@ -78,6 +97,8 @@ public Object mDMSCall(RequestInfo requestInfo){ * @return */ public Object getBusinessServiceMDMS(){ + + MDC.put(WorkflowConstants.TENANTID_MDC_STRING, workflowConfig.getStateLevelTenantId()); MdmsCriteriaReq mdmsCriteriaReq = getBusinessServiceMDMSRequest(new RequestInfo(), workflowConfig.getStateLevelTenantId()); Object result = serviceRequestRepository.fetchResult(getMdmsSearchUrl(), mdmsCriteriaReq); return result; @@ -188,7 +209,7 @@ public StringBuilder getMdmsSearchUrl() { return new StringBuilder().append(config.getMdmsHost()).append(config.getMdmsEndPoint()); } - public Integer fetchSlotPercentageForNearingSla(RequestInfo requestInfo) { + public Integer fetchSlotPercentageForNearingSla(RequestInfo requestInfo, String tenantId) { // master details for WF SLA module List masterDetails = new ArrayList<>(); @@ -198,7 +219,7 @@ public Integer fetchSlotPercentageForNearingSla(RequestInfo requestInfo) { .moduleName(MDMS_COMMON_MASTERS).build()); MdmsCriteria mdmsCriteria = MdmsCriteria.builder().moduleDetails(wfModuleDtls) - .tenantId(config.getStateLevelTenantId()) + .tenantId(centralInstanceUtil.getStateLevelTenant(tenantId)) .build(); MdmsCriteriaReq mdmsCriteriaReq = MdmsCriteriaReq.builder().mdmsCriteria(mdmsCriteria) diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/WorkflowService.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/WorkflowService.java index 326615bd7f3..54a9848ac6e 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/WorkflowService.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/WorkflowService.java @@ -117,7 +117,7 @@ public Integer count(RequestInfo requestInfo,ProcessInstanceSearchCriteria crite if(ObjectUtils.isEmpty(criteria.getBusinessService())) throw new CustomException("EG_WF_BUSINESSSRV_ERR", "Providing business service is mandatory for nearing escalation count"); - Integer slotPercentage = mdmsService.fetchSlotPercentageForNearingSla(requestInfo); + Integer slotPercentage = mdmsService.fetchSlotPercentageForNearingSla(requestInfo,criteria.getTenantId()); Long maxBusinessServiceSla = businessMasterService.getMaxBusinessServiceSla(criteria); criteria.setSlotPercentageSlaLimit(maxBusinessServiceSla - slotPercentage * (maxBusinessServiceSla/100)); } @@ -224,8 +224,8 @@ private void enrichSearchCriteriaFromUser(RequestInfo requestInfo,ProcessInstanc List actionableStatuses = util.getActionableStatusesForRole(requestInfo,businessServices,criteria); criteria.setAssignee(requestInfo.getUserInfo().getUuid()); criteria.setStatus(actionableStatuses);*/ - - util.enrichStatusesInSearchCriteria(requestInfo, criteria); + Map>> roleTenantAndStatusMapping = businessServiceRepository.getRoleTenantAndStatusMapping(criteria.getTenantId()); + util.enrichStatusesInSearchCriteria(requestInfo, criteria, roleTenantAndStatusMapping); criteria.setAssignee(requestInfo.getUserInfo().getUuid()); diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowConstants.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowConstants.java index 9869cf2d950..36129e3fff8 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowConstants.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowConstants.java @@ -52,6 +52,8 @@ public WorkflowConstants() {} public static final String FSM_MODULE="FSM"; + public static final String TENANTID_MDC_STRING = "TENANTID"; + public static String SCHEMA_REPLACE_STRING = "{SCHEMA}"; } diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowUtil.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowUtil.java index 44200dd1e53..756dd812252 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowUtil.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/util/WorkflowUtil.java @@ -16,7 +16,6 @@ import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; import org.egov.wf.config.WorkflowConfig; -import org.egov.wf.repository.BusinessServiceRepository; import org.egov.wf.web.models.Action; import org.egov.wf.web.models.AuditDetails; import org.egov.wf.web.models.BusinessService; @@ -27,28 +26,19 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - @Component public class WorkflowUtil { - private ObjectMapper mapper; - private WorkflowConfig config; - private BusinessServiceRepository businessServiceRepository; - - @Autowired - public WorkflowUtil(ObjectMapper mapper, WorkflowConfig config, BusinessServiceRepository businessServiceRepository) { - this.mapper = mapper; + public WorkflowUtil( WorkflowConfig config) { this.config = config; - this.businessServiceRepository = businessServiceRepository; } @Autowired - private MultiStateInstanceUtil multiStateInstanceUtil; + private MultiStateInstanceUtil centralInstanceUtil; @@ -254,9 +244,8 @@ public Map> getRoleToTenantId(RequestInfo requestInfo){ * @param criteria * @return */ - public void enrichStatusesInSearchCriteria(RequestInfo requestInfo, ProcessInstanceSearchCriteria criteria){ + public void enrichStatusesInSearchCriteria(RequestInfo requestInfo, ProcessInstanceSearchCriteria criteria, Map>> roleTenantAndStatusMapping){ - Map>> roleTenantAndStatusMapping = businessServiceRepository.getRoleTenantAndStatusMapping(criteria.getTenantId()); Map> roleToTenantIdMap = getRoleToTenantId(requestInfo); List tenantSpecificStatuses = new LinkedList<>(); @@ -462,10 +451,10 @@ public Map getStateUuidToTenantIdMap(List busine /** * Checks if the tenantId is valid to take action * @param roleTenantId The tenantId of the role - * @param applicationTeanantId The tenantId of the application + * @param applicationTenantId The tenantId of the application * @return */ - private Boolean isTenantIdValid(String roleTenantId, String applicationTeanantId){ + private Boolean isTenantIdValid(String roleTenantId, String applicationTenantId){ if(roleTenantId == null) return false; @@ -473,11 +462,12 @@ private Boolean isTenantIdValid(String roleTenantId, String applicationTeanantId Boolean isTenantIdValid = false; // If the tenantId are same role can take action - if(roleTenantId.equalsIgnoreCase(applicationTeanantId)) + if(roleTenantId.equalsIgnoreCase(applicationTenantId)) isTenantIdValid = true; // If the role tenantId is statelevel it can take action - else if(roleTenantId.equalsIgnoreCase(applicationTeanantId.split("\\.")[0])) + + else if(roleTenantId.equalsIgnoreCase(centralInstanceUtil.getStateLevelTenant(applicationTenantId))) isTenantIdValid = true; return isTenantIdValid; @@ -486,7 +476,7 @@ else if(roleTenantId.equalsIgnoreCase(applicationTeanantId.split("\\.")[0])) private Boolean isTenantStateLevel(String tenantId){ - return multiStateInstanceUtil.isTenantIdStateLevel(tenantId); + return centralInstanceUtil.isTenantIdStateLevel(tenantId); } @@ -503,9 +493,9 @@ public String replaceSchemaPlaceholder(String query, String tenantId) { String finalQuery = null; if (config.getIsEnvironmentCentralInstance()) { - String multiInstanceSchema = multiStateInstanceUtil.getStateLevelTenant(tenantId); + String multiInstanceSchema = centralInstanceUtil.getStateLevelTenant(tenantId); try { - finalQuery = multiStateInstanceUtil.replaceSchemaPlaceholder(query, multiInstanceSchema); + finalQuery = centralInstanceUtil.replaceSchemaPlaceholder(query, multiInstanceSchema); }catch (Exception e){ throw new CustomException("EG_WF_SEARCH_ERR", "Invalid tenantId provided as part of search"); } diff --git a/core-services/egov-workflow-v2/src/main/resources/application.properties b/core-services/egov-workflow-v2/src/main/resources/application.properties index 617941385e2..a22204ff66d 100644 --- a/core-services/egov-workflow-v2/src/main/resources/application.properties +++ b/core-services/egov-workflow-v2/src/main/resources/application.properties @@ -73,7 +73,7 @@ management.endpoints.web.base-path=/ cache.expiry.workflow.minutes=15 -egov.statelevel.tenantid=pb +state.level.tenant.id=pb egov.wf.escalation.batch.size=50 # central-instance configs diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/BusinessServiceRepositoryTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/BusinessServiceRepositoryTest.java index 62591c0ad69..532b4e28149 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/BusinessServiceRepositoryTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/BusinessServiceRepositoryTest.java @@ -1,13 +1,9 @@ package org.egov.wf.repository; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import ch.qos.logback.core.util.COWArrayList; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -16,26 +12,24 @@ import org.egov.wf.repository.querybuilder.BusinessServiceQueryBuilder; import org.egov.wf.repository.rowmapper.BusinessServiceRowMapper; import org.egov.wf.service.MDMSService; +import org.egov.wf.util.WorkflowUtil; import org.egov.wf.web.models.BusinessServiceSearchCriteria; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; +import ch.qos.logback.core.util.COWArrayList; + @ContextConfiguration(classes = {BusinessServiceRepository.class}) @ExtendWith(SpringExtension.class) class BusinessServiceRepositoryTest { @MockBean private BusinessServiceQueryBuilder businessServiceQueryBuilder; - @Autowired - private BusinessServiceRepository businessServiceRepository; - @MockBean private BusinessServiceRowMapper businessServiceRowMapper; @@ -47,6 +41,9 @@ class BusinessServiceRepositoryTest { @MockBean private WorkflowConfig workflowConfig; + + @MockBean + private WorkflowUtil workflowUtil; @Test diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilderTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilderTest.java index a26e3cb1c28..c40fca8a4ea 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilderTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/BusinessServiceQueryBuilderTest.java @@ -32,8 +32,8 @@ void testGetBusinessServices() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE ORDER" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE ORDER" + " BY seq", this.businessServiceQueryBuilder.getBusinessServices(criteria, new ArrayList<>())); } @@ -53,8 +53,8 @@ void testGetBusinessServiceswithcriteria() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(criteria, objectList)); assertEquals(1, objectList.size()); @@ -75,8 +75,8 @@ void testGetBusinessServiceswithbusinesscriteria() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(businessServiceSearchCriteria, objectList)); verify(businessServiceSearchCriteria).getTenantId(); @@ -96,8 +96,8 @@ void testGetBusinessServicesexpected2() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); BusinessServiceSearchCriteria businessServiceSearchCriteria = mock(BusinessServiceSearchCriteria.class); when(businessServiceSearchCriteria.getTenantId()).thenReturn("42"); when(businessServiceSearchCriteria.getActionUuids()).thenReturn(stringList); @@ -110,8 +110,8 @@ void testGetBusinessServicesexpected2() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? AND ac.uuid IN ( ?) ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(businessServiceSearchCriteria, objectList)); verify(businessServiceSearchCriteria).getTenantId(); @@ -131,8 +131,8 @@ void GetBusinessServicesorderbyseq() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); BusinessServiceSearchCriteria businessServiceSearchCriteria = mock(BusinessServiceSearchCriteria.class); when(businessServiceSearchCriteria.getTenantId()).thenReturn("42"); when(businessServiceSearchCriteria.getActionUuids()).thenReturn(new ArrayList<>()); @@ -145,8 +145,8 @@ void GetBusinessServicesorderbyseq() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? AND bs.businessService IN ( ?) ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(businessServiceSearchCriteria, objectList)); verify(businessServiceSearchCriteria).getTenantId(); @@ -166,8 +166,8 @@ void GetBusinessServices() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); BusinessServiceSearchCriteria businessServiceSearchCriteria = mock(BusinessServiceSearchCriteria.class); when(businessServiceSearchCriteria.getTenantId()).thenReturn("42"); when(businessServiceSearchCriteria.getActionUuids()).thenReturn(new ArrayList<>()); @@ -180,8 +180,8 @@ void GetBusinessServices() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? AND st.uuid IN ( ?) ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(businessServiceSearchCriteria, objectList)); verify(businessServiceSearchCriteria).getTenantId(); @@ -201,16 +201,16 @@ void testGetBusinessServices3() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); stringList.add("SELECT bs.*,st.*,ac.*,bs.uuid as bs_uuid, bs.lastModifiedTime as bs_lastModifiedTime,bs.createdTime" + " as bs_createdTime,bs.createdBy as bs_createdBy,bs.lastModifiedBy as bs_lastModifiedBy,bs.tenantId" + " as bs_tenantId, st.lastModifiedTime as st_lastModifiedTime,st.createdTime as st_createdTime,st.tenantId" + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE "); BusinessServiceSearchCriteria businessServiceSearchCriteria = mock(BusinessServiceSearchCriteria.class); when(businessServiceSearchCriteria.getTenantId()).thenReturn("42"); when(businessServiceSearchCriteria.getActionUuids()).thenReturn(stringList); @@ -223,8 +223,8 @@ void testGetBusinessServices3() { + " as st_tenantId,st.createdBy as st_createdBy,st.uuid as st_uuid, st.lastModifiedBy as st_lastModifiedBy," + " ac.lastModifiedTime as ac_lastModifiedTime,ac.createdTime as ac_createdTime,ac.createdBy as" + " ac_createdBy,ac.lastModifiedBy as ac_lastModifiedBy,ac.uuid as ac_uuid,ac.tenantId as ac_tenantId,ac.active" - + " as ac_active FROM eg_wf_businessService_v2 bs INNER JOIN eg_wf_state_v2 st ON st.businessServiceId" - + " = bs.uuid LEFT OUTER JOIN eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + + " as ac_active FROM {SCHEMA}.eg_wf_businessService_v2 bs INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.businessServiceId" + + " = bs.uuid LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND ac.active=TRUE WHERE" + " bs.tenantId = ? AND ac.uuid IN ( ?, ?) ORDER BY seq", this.businessServiceQueryBuilder.getBusinessServices(businessServiceSearchCriteria, objectList)); verify(businessServiceSearchCriteria).getTenantId(); diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilderTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilderTest.java index 42b0cce0594..52cc387e388 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilderTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/EscalationQueryBuilderTest.java @@ -33,7 +33,7 @@ void testGetEscalationQuery() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wfprocessinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" + " wf.createdtime - wf.statesla > ? AND (select extract(epoch from current_timestamp)) * 1000 -" + " wf.createdtime - wf.businessservicesla > ? ", @@ -58,7 +58,7 @@ void testGetEscalationQuerywithstatesla() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wfprocessinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" + " wf.createdtime - wf.statesla > ? ", this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); @@ -81,7 +81,7 @@ void testGetEscalationQuerywithbusinessservicesla() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wfprocessinstance_v2 WHERE businessservice = ? AND tenantid= ? ) wf WHERE" + " rank_number = 1 AND wf.status = ? AND (select extract(epoch from current_timestamp)) * 1000 -" + " wf.createdtime - wf.businessservicesla > ? ", this.escalationQueryBuilder.getEscalationQuery(escalationSearchCriteria, objectList)); diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilderTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilderTest.java index 179737f885f..bebf39565f6 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilderTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/querybuilder/WorkflowQueryBuilderTest.java @@ -54,7 +54,7 @@ void testGetProcessInstanceIds() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in (select" - + " processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + + " processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + " = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -94,7 +94,7 @@ void testGetProcessInstanceIds4() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in (select" - + " processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + + " processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + " = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -163,7 +163,7 @@ void testGetProcessInstanceIds6() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in (select" - + " processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + + " processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + " = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -262,9 +262,9 @@ void testGetProcessInstanceIds7() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + " pi_outer.businessid and tenantid = ? ) AND pi_outer.tenantid=? and id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime DESC " + " OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -363,7 +363,7 @@ void testGetProcessInstanceIds9() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in (select" - + " processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + + " processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + " = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -462,7 +462,7 @@ void testGetProcessInstanceIds10() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in (select" - + " processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + + " processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid" + " = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -658,7 +658,7 @@ void testGetProcessInstanceIds12() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in" - + " (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + + " (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + " pi_outer.tenantid = ? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime DESC OFFSET" + " ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getHistory(); @@ -755,7 +755,7 @@ void testGetProcessInstanceIds13() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in" - + " (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + + " (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + " pi_outer.tenantid = ? AND pi_outer.modulename =? ORDER BY pi_outer.lastModifiedTime DESC OFFSET" + " ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getHistory(); @@ -854,7 +854,7 @@ void testGetProcessInstanceIds14() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and id in" - + " (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + + " (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND" + " pi_outer.tenantid = ? AND pi_outer.businessservice =? ORDER BY pi_outer.lastModifiedTime DESC " + " OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -955,7 +955,7 @@ void testGetProcessInstanceIds15() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and pi_outer" - + ".businessId IN ( ?) and id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where" + + ".businessId IN ( ?) and id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where" + " asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? AND pi_outer.modulename" + " =? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -1057,7 +1057,7 @@ void testGetProcessInstanceIds16() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and pi_outer" - + ".businessId IN ( ?, ?) and id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where" + + ".businessId IN ( ?, ?) and id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where" + " asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? AND pi_outer.modulename" + " =? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -1159,7 +1159,7 @@ void testGetProcessInstanceIds17() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and pi_outer.id" - + " IN ( ?) and id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee" + + " IN ( ?) and id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee" + " = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER" + " BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -1261,7 +1261,7 @@ void testGetProcessInstanceIds18() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.tenantid=? and pi_outer.status" - + " IN ( ?) and id in (select processinstanceid from eg_wf_assignee_v2 asg_inner where asg_inner.assignee" + + " IN ( ?) and id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee" + " = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? AND pi_outer.modulename =? ORDER" + " BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getProcessInstanceIds(processInstanceSearchCriteria, objectList)); @@ -1449,9 +1449,9 @@ void testGetInboxIdCount() { ArrayList objectList = new ArrayList<>(); assertEquals( " select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer" + ".lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); @@ -1486,9 +1486,9 @@ void testGetInboxIdCount2() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer" + ".lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); @@ -1550,9 +1550,9 @@ void testGetInboxIdCount3() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer" + ".lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); @@ -1642,9 +1642,9 @@ void testGetInboxIdCount4() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getIsAssignedToMeCount(); @@ -1732,9 +1732,9 @@ void testGetInboxIdCount5() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getIsAssignedToMeCount(); @@ -1822,9 +1822,9 @@ void testGetInboxIdCount6() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select" + " extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY" + " pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); @@ -1914,9 +1914,9 @@ void testGetInboxIdCount7() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals(" select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select" + " extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY" + " pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxIdCount(processInstanceSearchCriteria, objectList)); @@ -1984,8 +1984,8 @@ void testGetInboxIdQuery3() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2026,8 +2026,8 @@ void testGetInboxIdQuery4() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2098,8 +2098,8 @@ void testGetInboxIdQuery6() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2200,8 +2200,8 @@ void testGetInboxIdQuery7() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2303,8 +2303,8 @@ void testGetInboxIdQuery8() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2406,8 +2406,8 @@ void testGetInboxIdQuery9() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getInboxIdQuery(processInstanceSearchCriteria, objectList, true)); @@ -2506,8 +2506,8 @@ void testGetInboxIdQuery10() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", workflowQueryBuilder.getInboxIdQuery(processInstanceSearchCriteria, objectList, true)); @@ -2606,8 +2606,8 @@ void testGetInboxIdQuery11() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2708,8 +2708,8 @@ void testGetInboxIdQuery12() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -2810,8 +2810,8 @@ void testGetInboxIdQuery13() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select extract(epoch from" + " current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", @@ -2912,8 +2912,8 @@ void testGetInboxIdQuery14() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select extract(epoch from" + " current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime" + " DESC OFFSET ? LIMIT ? ", @@ -3014,8 +3014,8 @@ void testGetInboxIdQuery15() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC ", @@ -3114,8 +3114,8 @@ void testGetInboxIdQuery17() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -3219,7 +3219,7 @@ void testGetInboxIdQuery19() { ArrayList objectList = new ArrayList<>(); assertEquals( " select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + " pi_outer.businessid and tenantid = ? ) AND pi_outer.businessservice =? AND ((select extract(epoch" + " from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer" + ".lastModifiedTime DESC OFFSET ? LIMIT ? ", @@ -3286,11 +3286,11 @@ void testGetInboxCount() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals("select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice" @@ -3327,11 +3327,11 @@ void testGetInboxCount2() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice" @@ -3396,11 +3396,11 @@ void testGetInboxCount3() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND" + " ? ORDER BY pi_outer.lastModifiedTime DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice" @@ -3493,11 +3493,11 @@ void testGetInboxCount4() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " ORDER BY pi_outer.lastModifiedTime DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq" + ".PI_STATUS", @@ -3589,11 +3589,11 @@ void testGetInboxCount5() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND pi_outer.businessservice =? " + " ORDER BY pi_outer.lastModifiedTime DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq" + ".PI_STATUS", @@ -3684,11 +3684,11 @@ void testGetInboxCount6() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select extract(epoch from" + " current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime" + " DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq.PI_STATUS", @@ -3780,11 +3780,11 @@ void testGetInboxCount7() { ArrayList objectList = new ArrayList<>(); assertEquals( "select count(DISTINCT cq.id),cq.applicationStatus,cq.businessservice,cq.PI_STATUS as statusId from " - + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM eg_wf" - + "_processinstance_v2 ppi JOIN eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + + " ( select ppi.id,ppi.businessservice,ppst.applicationstatus,ppi.status as PI_STATUS FROM {SCHEMA}.eg_wf" + + "_processinstance_v2 ppi JOIN {SCHEMA}.eg_wf_state_v2 ppst ON ( ppst.uuid =ppi.status ) WHERE ppi.id IN ( select" + " id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE pi_outer.lastmodifiedTime = (SELECT" - + " max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" - + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from eg_wf_assignee_v2" + + " max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner where pi_inner.businessid =" + + " pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid from {SCHEMA}.eg_wf_assignee_v2" + " asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND ((select extract(epoch from" + " current_timestamp)) * 1000 - pi_outer.lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime" + " DESC ) ) cq GROUP BY cq.applicationStatus,cq.businessservice,cq.PI_STATUS", @@ -3876,9 +3876,9 @@ void testGetInboxCount10() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals("select count(DISTINCT id) from ( select id from {SCHEMA}.eg_wf_processinstance_v2 pi_outer WHERE " - + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from eg_wf_processinstance_v2 as pi_inner" + + " pi_outer.lastmodifiedTime = (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf_processinstance_v2 as pi_inner" + " where pi_inner.businessid = pi_outer.businessid and tenantid = ? ) AND id in (select processinstanceid" - + " from eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + + " from {SCHEMA}.eg_wf_assignee_v2 asg_inner where asg_inner.assignee = ?) AND pi_outer.tenantid = ? AND" + " pi_outer.businessservice =? AND ((select extract(epoch from current_timestamp)) * 1000 - pi_outer" + ".lastmodifiedTime) BETWEEN ? AND ? ORDER BY pi_outer.lastModifiedTime DESC ) as count", workflowQueryBuilder.getInboxCount(processInstanceSearchCriteria, objectList, false)); @@ -4178,7 +4178,7 @@ void testGetProcessInstanceCount4() { + "_assignee_v2 asg ON asg.processinstanceid = pi.id LEFT OUTER JOIN {SCHEMA}.eg_wf_document_v2" + " doc ON doc.processinstanceid = pi.id INNER JOIN {SCHEMA}.eg_wf_state_v2 st ON st.uuid =" + " pi.status LEFT OUTER JOIN {SCHEMA}.eg_wf_action_v2 ac ON ac.currentState = st.uuid AND" - + " ac.active=TRUE WHERE pi.lastmodifiedTime IN (SELECT max(lastmodifiedTime) from eg_wf" + + " ac.active=TRUE WHERE pi.lastmodifiedTime IN (SELECT max(lastmodifiedTime) from {SCHEMA}.eg_wf" + "_processinstance_v2 GROUP BY businessid) AND pi.tenantid=? AND pi.businessservice =? AND ((select" + " extract(epoch from current_timestamp)) * 1000 - pi.lastmodifiedTime) BETWEEN ? AND ? AND asg.assignee=?" + " ) as cq GROUP BY cq.applicationStatus,cq.businessservice,cq.PI_STATUS", @@ -5269,7 +5269,7 @@ void testGetInboxApplicationsBusinessIdsQuery() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals( - "SELECT DISTINCT businessid FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + "SELECT DISTINCT businessid FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + " businessservice = ? ", workflowQueryBuilder.getInboxApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); assertEquals(3, objectList.size()); @@ -5303,7 +5303,7 @@ void testGetInboxApplicationsBusinessIdsQuery2() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals( - "SELECT DISTINCT businessid FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + "SELECT DISTINCT businessid FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + " businessservice = ? ", workflowQueryBuilder.getInboxApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); assertEquals(3, objectList.size()); @@ -5359,7 +5359,7 @@ void testGetInboxApplicationsBusinessIdsQuery3() { processInstanceSearchCriteria.setToDate(1L); ArrayList objectList = new ArrayList<>(); assertEquals( - "SELECT DISTINCT businessid FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + "SELECT DISTINCT businessid FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND createdby = ? AND" + " businessservice = ? ", workflowQueryBuilder.getInboxApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getAssignee(); @@ -5421,9 +5421,9 @@ void testGetEscalatedApplicationsCount3() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId" - + " ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND " + + " ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND " + " businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank" + " = 2 ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5462,9 +5462,9 @@ void testGetEscalatedApplicationsCount5() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId" - + " ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND " + + " ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND " + " businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank" + " = 2 ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5479,9 +5479,9 @@ void testGetEscalatedApplicationsCount6() { RequestInfo requestInfo = mock(RequestInfo.class); when(requestInfo.getUserInfo()).thenReturn(new User(123L, "janedoe", "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 ", + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 ", "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 ", + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 ", "42", "42", new ArrayList<>(), "42", "01234567-89AB-CDEF-FEDC-BA9876543210")); ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); @@ -5509,9 +5509,9 @@ void testGetEscalatedApplicationsCount6() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + " = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 AND asg = ?" + " ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5577,9 +5577,9 @@ void testGetEscalatedApplicationsCount8() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? and businessId" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? and businessId" + " IN ( ?) AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE" + " outer_rank = 2 ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5621,7 +5621,7 @@ void testGetEscalatedApplicationsCount9() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); stringList.add("foo"); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getIsEscalatedCount()).thenReturn(true); @@ -5672,9 +5672,9 @@ void testGetEscalatedApplicationsCount9() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? and businessId" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? and businessId" + " IN ( ?, ?) AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final" + " WHERE outer_rank = 2 ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5767,9 +5767,9 @@ void testGetEscalatedApplicationsCount11() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + " = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? " + " LIMIT ? ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5864,9 +5864,9 @@ void testGetEscalatedApplicationsCount12() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + " = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? " + " LIMIT ? ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -5961,9 +5961,9 @@ void testGetEscalatedApplicationsCount14() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + " = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? " + " LIMIT ? ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -6058,9 +6058,9 @@ void testGetEscalatedApplicationsCount15() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice" + " = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? " + " LIMIT ? ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -6155,9 +6155,9 @@ void testGetEscalatedApplicationsCount16() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId" - + " ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND " + + " ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND " + " businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank" + " = 2 ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -6250,9 +6250,9 @@ void testGetEscalatedApplicationsCount17() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER" - + " BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? ) wf WHERE" + + " BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? ) wf WHERE" + " rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? LIMIT ? ) as" + " count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -6347,9 +6347,9 @@ void testGetEscalatedApplicationsCount18() { assertEquals( "select count(DISTINCT businessid) from (SELECT businessid from ( SELECT wf.* , assg.assignee AS asg," + " DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime DESC) outer_rank FROM" - + " eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + + " {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id = assg.processinstanceid" + " WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId" - + " ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE businessservice = ?" + + " ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE businessservice = ?" + " ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 OFFSET ? LIMIT" + " ? ) as count", workflowQueryBuilder.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria, objectList)); @@ -6415,9 +6415,9 @@ void testGetAutoEscalatedApplicationsFinalQuery3() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6456,9 +6456,9 @@ void testGetAutoEscalatedApplicationsFinalQuery5() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6474,9 +6474,9 @@ void testGetAutoEscalatedApplicationsFinalQuery6() { RequestInfo requestInfo = mock(RequestInfo.class); when(requestInfo.getUserInfo()).thenReturn(new User(123L, "janedoe", "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 ", + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 ", "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 ", + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 ", "42", "42", new ArrayList<>(), "42", "01234567-89AB-CDEF-FEDC-BA9876543210")); ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); @@ -6503,9 +6503,9 @@ void testGetAutoEscalatedApplicationsFinalQuery6() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 AND asg = ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6571,9 +6571,9 @@ void testGetAutoEscalatedApplicationsFinalQuery8() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? and businessId IN ( ?) AND businessservice = ? ) wf WHERE rank_number = 1" + " AND wf.escalated = true ) ) final WHERE outer_rank = 2 ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6616,7 +6616,7 @@ void testGetAutoEscalatedApplicationsFinalQuery9() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); stringList.add("foo"); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getIsEscalatedCount()).thenReturn(true); @@ -6666,9 +6666,9 @@ void testGetAutoEscalatedApplicationsFinalQuery9() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? and businessId IN ( ?, ?) AND businessservice = ? ) wf WHERE rank_number =" + " 1 AND wf.escalated = true ) ) final WHERE outer_rank = 2 ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6762,9 +6762,9 @@ void testGetAutoEscalatedApplicationsFinalQuery11() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6859,9 +6859,9 @@ void testGetAutoEscalatedApplicationsFinalQuery12() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -6956,9 +6956,9 @@ void testGetAutoEscalatedApplicationsFinalQuery14() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -7053,9 +7053,9 @@ void testGetAutoEscalatedApplicationsFinalQuery15() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -7150,9 +7150,9 @@ void testGetAutoEscalatedApplicationsFinalQuery16() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )" + " ) final WHERE outer_rank = 2 ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -7245,9 +7245,9 @@ void testGetAutoEscalatedApplicationsFinalQuery17() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE tenantid = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE outer_rank" + " = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -7342,9 +7342,9 @@ void testGetAutoEscalatedApplicationsFinalQuery18() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT businessid from ( SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid" - + " ORDER BY wf.createdtime DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2" + + " ORDER BY wf.createdtime DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2" + " assg ON wf.id = assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK" - + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2" + + " () OVER (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2" + " WHERE businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ) ) final WHERE" + " outer_rank = 2 OFFSET ? LIMIT ? ", workflowQueryBuilder.getAutoEscalatedApplicationsFinalQuery(requestInfo, processInstanceSearchCriteria, @@ -7408,9 +7408,9 @@ void testGetAutoEscalatedApplicationsRankedQuery() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime" - + " DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id =" + + " DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id =" + " assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER" - + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE" + + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE" + " tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )", workflowQueryBuilder.getAutoEscalatedApplicationsRankedQuery(processInstanceSearchCriteria, objectList)); assertEquals(2, objectList.size()); @@ -7445,9 +7445,9 @@ void testGetAutoEscalatedApplicationsRankedQuery2() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime" - + " DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id =" + + " DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id =" + " assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER" - + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE" + + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE" + " tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )", workflowQueryBuilder.getAutoEscalatedApplicationsRankedQuery(processInstanceSearchCriteria, objectList)); assertEquals(2, objectList.size()); @@ -7504,9 +7504,9 @@ void testGetAutoEscalatedApplicationsRankedQuery3() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime" - + " DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id =" + + " DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id =" + " assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER" - + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE" + + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE" + " tenantid = ? AND businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true )", workflowQueryBuilder.getAutoEscalatedApplicationsRankedQuery(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); @@ -7543,7 +7543,7 @@ void testGetAutoEscalatedApplicationsRankedQuery4() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); @@ -7591,9 +7591,9 @@ void testGetAutoEscalatedApplicationsRankedQuery4() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime" - + " DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id =" + + " DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id =" + " assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER" - + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE" + + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE" + " tenantid = ? and businessId IN ( ?) AND businessservice = ? ) wf WHERE rank_number = 1 AND" + " wf.escalated = true )", workflowQueryBuilder.getAutoEscalatedApplicationsRankedQuery(processInstanceSearchCriteria, objectList)); @@ -7659,10 +7659,10 @@ void testGetAutoEscalatedApplicationsRankedQuery5() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); @@ -7710,9 +7710,9 @@ void testGetAutoEscalatedApplicationsRankedQuery5() { ArrayList objectList = new ArrayList<>(); assertEquals( "SELECT wf.* , assg.assignee AS asg, DENSE_RANK() OVER(PARTITION BY wf.businessid ORDER BY wf.createdtime" - + " DESC) outer_rank FROM eg_wf_processinstance_v2 wf LEFT OUTER JOIN eg_wf_assignee_v2 assg ON wf.id =" + + " DESC) outer_rank FROM {SCHEMA}.eg_wf_processinstance_v2 wf LEFT OUTER JOIN {SCHEMA}.eg_wf_assignee_v2 assg ON wf.id =" + " assg.processinstanceid WHERE wf.businessid IN (select businessId from ( SELECT *,RANK () OVER" - + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM eg_wf_processinstance_v2 WHERE" + + " (PARTITION BY businessId ORDER BY createdtime DESC) rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE" + " tenantid = ? and businessId IN ( ?, ?) AND businessservice = ? ) wf WHERE rank_number = 1 AND" + " wf.escalated = true )", workflowQueryBuilder.getAutoEscalatedApplicationsRankedQuery(processInstanceSearchCriteria, objectList)); @@ -7771,7 +7771,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + " rank_number = 1 AND wf.escalated = true ", workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); assertEquals(2, objectList.size()); @@ -7806,7 +7806,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery2() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + " rank_number = 1 AND wf.escalated = true ", workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); assertEquals(2, objectList.size()); @@ -7863,7 +7863,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery3() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? AND businessservice = ? ) wf WHERE" + " rank_number = 1 AND wf.escalated = true ", workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); @@ -7900,7 +7900,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery4() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); @@ -7948,7 +7948,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery4() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? and businessId IN ( ?) AND " + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? and businessId IN ( ?) AND " + " businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ", workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); @@ -7985,10 +7985,10 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery5() { ArrayList stringList = new ArrayList<>(); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); stringList .add("select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 "); + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 "); ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); @@ -8036,7 +8036,7 @@ void testGetAutoEscalatedApplicationsBusinessIdsQuery5() { ArrayList objectList = new ArrayList<>(); assertEquals( "select businessId from ( SELECT *,RANK () OVER (PARTITION BY businessId ORDER BY createdtime DESC)" - + " rank_number FROM eg_wf_processinstance_v2 WHERE tenantid = ? and businessId IN ( ?, ?) AND " + + " rank_number FROM {SCHEMA}.eg_wf_processinstance_v2 WHERE tenantid = ? and businessId IN ( ?, ?) AND " + " businessservice = ? ) wf WHERE rank_number = 1 AND wf.escalated = true ", workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(processInstanceSearchCriteria, objectList)); verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/service/WorkflowServiceTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/service/WorkflowServiceTest.java index 7d286f4ea54..29049104629 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/service/WorkflowServiceTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/service/WorkflowServiceTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; @@ -15,7 +15,9 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.User; @@ -29,7 +31,6 @@ import org.egov.wf.web.models.ProcessInstanceRequest; import org.egov.wf.web.models.ProcessInstanceSearchCriteria; import org.egov.wf.web.models.ProcessStateAndAction; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -72,6 +73,8 @@ class WorkflowServiceTest { @MockBean private WorkflowValidator workflowValidator; + + Map>> roleTenantAndStatusMapping = new HashMap<>(); @Test @@ -216,7 +219,7 @@ void testSearchWithActualSearchResult() { @Test void testCount() { when(this.worKflowRepository.getProcessInstancesCount((ProcessInstanceSearchCriteria) any())).thenReturn(3); - when(this.mDMSService.fetchSlotPercentageForNearingSla((RequestInfo) any())).thenReturn(1); + when(this.mDMSService.fetchSlotPercentageForNearingSla((RequestInfo) any(), (String) any())).thenReturn(1); when(this.businessMasterService.getMaxBusinessServiceSla((ProcessInstanceSearchCriteria) any())).thenReturn(1L); RequestInfo requestInfo = new RequestInfo(); @@ -243,7 +246,7 @@ void testCount() { processInstanceSearchCriteria.setToDate(1L); assertEquals(3, this.workflowService.count(requestInfo, processInstanceSearchCriteria).intValue()); verify(this.worKflowRepository).getProcessInstancesCount((ProcessInstanceSearchCriteria) any()); - verify(this.mDMSService).fetchSlotPercentageForNearingSla((RequestInfo) any()); + verify(this.mDMSService).fetchSlotPercentageForNearingSla((RequestInfo) any(), (String) any()); verify(this.businessMasterService).getMaxBusinessServiceSla((ProcessInstanceSearchCriteria) any()); assertEquals(1L, processInstanceSearchCriteria.getSlotPercentageSlaLimit().longValue()); } @@ -252,7 +255,7 @@ void testCount() { @Test void testCountWithErrorCode() { when(this.worKflowRepository.getProcessInstancesCount((ProcessInstanceSearchCriteria) any())).thenReturn(3); - when(this.mDMSService.fetchSlotPercentageForNearingSla((RequestInfo) any())).thenReturn(1); + when(this.mDMSService.fetchSlotPercentageForNearingSla((RequestInfo) any(),(String) any())).thenReturn(1); when(this.businessMasterService.getMaxBusinessServiceSla((ProcessInstanceSearchCriteria) any())) .thenThrow(new CustomException("Code", "An error occurred")); RequestInfo requestInfo = new RequestInfo(); @@ -279,7 +282,7 @@ void testCountWithErrorCode() { processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); processInstanceSearchCriteria.setToDate(1L); assertThrows(CustomException.class, () -> this.workflowService.count(requestInfo, processInstanceSearchCriteria)); - verify(this.mDMSService).fetchSlotPercentageForNearingSla((RequestInfo) any()); + verify(this.mDMSService).fetchSlotPercentageForNearingSla((RequestInfo) any(), (String) any()); verify(this.businessMasterService).getMaxBusinessServiceSla((ProcessInstanceSearchCriteria) any()); } @@ -383,336 +386,6 @@ void testStatusCount() { } - @Test - void testStatusCountWithErrorFSM() { - doThrow(new CustomException("FSM", "An error occurred")).when(this.workflowUtil) - .enrichStatusesInSearchCriteria((RequestInfo) any(), (ProcessInstanceSearchCriteria) any()); - when(this.worKflowRepository.getProcessInstancesStatusCount((ProcessInstanceSearchCriteria) any())) - .thenReturn(new ArrayList<>()); - RequestInfo requestInfo = new RequestInfo(); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); - when(processInstanceSearchCriteria.isNull()).thenReturn(true); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertThrows(CustomException.class, - () -> this.workflowService.statusCount(requestInfo, processInstanceSearchCriteria)); - verify(this.workflowUtil).enrichStatusesInSearchCriteria((RequestInfo) any(), - (ProcessInstanceSearchCriteria) any()); - verify(processInstanceSearchCriteria).isNull(); - verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); - verify(processInstanceSearchCriteria).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - - @Test - void testStatusCountWithTrueService() { - doNothing().when(this.workflowUtil) - .enrichStatusesInSearchCriteria((RequestInfo) any(), (ProcessInstanceSearchCriteria) any()); - ArrayList objectList = new ArrayList<>(); - when(this.worKflowRepository.getInboxStatusCount((ProcessInstanceSearchCriteria) any())).thenReturn(objectList); - when(this.worKflowRepository.getProcessInstancesStatusCount((ProcessInstanceSearchCriteria) any())) - .thenReturn(new ArrayList<>()); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(new User()); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); - when(processInstanceSearchCriteria.isNull()).thenReturn(true); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualStatusCountResult = this.workflowService.statusCount(requestInfo, processInstanceSearchCriteria); - assertSame(objectList, actualStatusCountResult); - assertTrue(actualStatusCountResult.isEmpty()); - verify(this.workflowUtil).enrichStatusesInSearchCriteria((RequestInfo) any(), - (ProcessInstanceSearchCriteria) any()); - verify(this.worKflowRepository).getInboxStatusCount((ProcessInstanceSearchCriteria) any()); - verify(processInstanceSearchCriteria).isNull(); - verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); - verify(processInstanceSearchCriteria, atLeast(1)).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - @Test - void testStatusCountWithFSM() { - doNothing().when(this.workflowUtil) - .enrichStatusesInSearchCriteria((RequestInfo) any(), (ProcessInstanceSearchCriteria) any()); - when(this.worKflowRepository.getInboxStatusCount((ProcessInstanceSearchCriteria) any())) - .thenReturn(new ArrayList<>()); - ArrayList objectList = new ArrayList<>(); - when(this.worKflowRepository.getProcessInstancesStatusCount((ProcessInstanceSearchCriteria) any())) - .thenReturn(objectList); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(new User()); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getBusinessService()).thenReturn("FSM"); - when(processInstanceSearchCriteria.isNull()).thenReturn(true); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualStatusCountResult = this.workflowService.statusCount(requestInfo, processInstanceSearchCriteria); - assertSame(objectList, actualStatusCountResult); - assertTrue(actualStatusCountResult.isEmpty()); - verify(this.worKflowRepository).getProcessInstancesStatusCount((ProcessInstanceSearchCriteria) any()); - verify(processInstanceSearchCriteria).isNull(); - verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); - verify(processInstanceSearchCriteria).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - - @Test - void TestStatusCount() { - doNothing().when(this.workflowUtil) - .enrichStatusesInSearchCriteria((RequestInfo) any(), (ProcessInstanceSearchCriteria) any()); - when(this.worKflowRepository.getInboxStatusCount((ProcessInstanceSearchCriteria) any())) - .thenThrow(new CustomException("FSM", "An error occurred")); - when(this.worKflowRepository.getProcessInstancesStatusCount((ProcessInstanceSearchCriteria) any())) - .thenReturn(new ArrayList<>()); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(new User()); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getBusinessService()).thenReturn("Business Service"); - when(processInstanceSearchCriteria.isNull()).thenReturn(true); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertThrows(CustomException.class, - () -> this.workflowService.statusCount(requestInfo, processInstanceSearchCriteria)); - verify(this.workflowUtil).enrichStatusesInSearchCriteria((RequestInfo) any(), - (ProcessInstanceSearchCriteria) any()); - verify(this.worKflowRepository).getInboxStatusCount((ProcessInstanceSearchCriteria) any()); - verify(processInstanceSearchCriteria).isNull(); - verify(processInstanceSearchCriteria, atLeast(1)).getBusinessService(); - verify(processInstanceSearchCriteria, atLeast(1)).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - @Test void testEscalatedApplicationsSearch() { when(this.worKflowRepository.fetchEscalatedApplicationsBusinessIdsFromDb((RequestInfo) any(), diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/util/WorkflowUtilTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/util/WorkflowUtilTest.java index 486e0e96bb6..e3b461a6563 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/util/WorkflowUtilTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/util/WorkflowUtilTest.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; @@ -40,6 +41,8 @@ class WorkflowUtilTest { @Autowired private WorkflowUtil workflowUtil; + + Map>> roleTenantAndStatusMapping = new HashMap<>(); // @Test @@ -128,7 +131,7 @@ void testEnrichStatusesInSearchCriteriaWithUser() { processInstanceSearchCriteria.setTenantId("42"); processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); processInstanceSearchCriteria.setToDate(1L); - this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria); + this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria, roleTenantAndStatusMapping); verify(this.businessServiceRepository).getRoleTenantAndStatusMapping("tenantId"); User userInfo = requestInfo.getUserInfo(); assertSame(user, userInfo); @@ -185,7 +188,7 @@ void testEnrichStatusesInSearchCriteriaWithAddRole() { processInstanceSearchCriteria.setTenantId("42"); processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); processInstanceSearchCriteria.setToDate(1L); - this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria); + this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria, roleTenantAndStatusMapping); verify(this.businessServiceRepository).getRoleTenantAndStatusMapping("tenantId"); } @@ -221,7 +224,7 @@ void testEnrichStatusesInSearchCriteriaWithRoleList() { processInstanceSearchCriteria.setTenantId("42"); processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); processInstanceSearchCriteria.setToDate(1L); - this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria); + this.workflowUtil.enrichStatusesInSearchCriteria(requestInfo, processInstanceSearchCriteria, roleTenantAndStatusMapping); verify(this.businessServiceRepository).getRoleTenantAndStatusMapping("tenantId"); } diff --git a/core-services/pdf-service/src/index.js b/core-services/pdf-service/src/index.js index b2910d826f1..3b875e7aa73 100755 --- a/core-services/pdf-service/src/index.js +++ b/core-services/pdf-service/src/index.js @@ -119,7 +119,8 @@ var defaultFontMapping = { en_IN: 'default', hi_IN: 'default', pn_IN: 'BalooPaaji', - od_IN: 'BalooBhaina' + od_IN: 'BalooBhaina', + or_IN: 'BalooBhaina' } const printer = new pdfMakePrinter(fontDescriptors); @@ -1340,4 +1341,4 @@ const prepareBulk = async ( }; } }; -export default app; \ No newline at end of file +export default app;