Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Map<String, Object> getESQuery(InboxRequest inboxRequest, Boolean isPagin
nameToOperator, mustClauseList);

innerBoolClause.put(MUST_KEY, mustClauseList);
System.out.println("Final ES Query after adding must clause: " + baseEsQuery.toString());
log.info("Final ES Query after adding must clause: " + baseEsQuery.toString());
return baseEsQuery;
}

Expand Down Expand Up @@ -339,4 +339,5 @@ private String addDataPathToSearchParamKey(String key, Map<String, String> nameT

return path;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ private void enrichProcessInstanceInInboxItems(List<Inbox> items) {
private List<Inbox> getInboxItems(InboxRequest inboxRequest, String indexName) {
List<BusinessService> businessServices = workflowService.getBusinessServices(inboxRequest);
enrichActionableStatusesFromRole(inboxRequest, businessServices);
if (CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus())) {
return new ArrayList<>();
}

Map<String, Object> finalQueryBody = queryBuilder.getESQuery(inboxRequest, Boolean.TRUE);
try {
String q = mapper.writeValueAsString(finalQueryBody);
Expand Down Expand Up @@ -164,7 +162,8 @@ private void enrichActionableStatusesFromRole(InboxRequest inboxRequest, List<Bu
inboxRequest.getInbox().getProcessSearchCriteria());
log.info(StatusIdNameMap.toString());
List<String> actionableStatus = new ArrayList<>();
if (StatusIdNameMap.values().size() > 0) {
if (StatusIdNameMap.values().size() > 0 && processCriteria.getStatus() != null
&& !processCriteria.getStatus().isEmpty()) {
if (!CollectionUtils.isEmpty(processCriteria.getStatus())) {
processCriteria.getStatus().forEach(status -> {
if (StatusIdNameMap.values().contains(status)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@

import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
public class WorkflowService {

private InboxConfiguration config;
Expand Down Expand Up @@ -191,7 +194,7 @@ public BusinessService getBusinessService(String tenantId, RequestInfo requestIn

@Cacheable(value = "businessServices")
public List<BusinessService> getBusinessServices(InboxRequest request) {
String tenantId = request.getInbox().getTenantId().split("\\.")[0];
String tenantId = request.getInbox().getProcessSearchCriteria().getTenantId().split("\\.")[0];
RequestInfo requestInfo = request.getRequestInfo();
List<String> businessServicesCodes = request.getInbox().getProcessSearchCriteria().getBusinessService();
String businessServiceList = String.join(",", businessServicesCodes);
Expand Down Expand Up @@ -326,8 +329,6 @@ private StringBuilder getSearchURLWithParams(String tenantId, String businessSer
public HashMap<String, String> getActionableStatusesForRole(RequestInfo requestInfo,
List<BusinessService> businessServices, ProcessInstanceSearchCriteria criteria) {

String tenantId;
List<String> userRoleCodes;
Map<String, List<String>> tenantIdToUserRolesMap = getTenantIdToUserRolesMap(requestInfo);
Map<String, List<BusinessService>> tenantIdToBuisnessSevicesMap = getTenantIdToBuisnessSevicesMap(
businessServices);
Expand Down Expand Up @@ -374,15 +375,16 @@ public HashMap<String, String> getActionableStatusesForRole(RequestInfo requestI
public Map<String, List<String>> getTenantIdToUserRolesMap(RequestInfo requestInfo) {
Map<String, List<String>> tenantIdToUserRoles = new HashMap<>();
requestInfo.getUserInfo().getRoles().forEach(role -> {
if (tenantIdToUserRoles.containsKey(role.getTenantId())) {
tenantIdToUserRoles.get(role.getTenantId()).add(role.getCode());
if (tenantIdToUserRoles.containsKey(role.getTenantId().split("\\.")[0])) {
tenantIdToUserRoles.get(role.getTenantId().split("\\.")[0]).add(role.getCode());
} else {
List<String> roleCodes = new LinkedList<>();
roleCodes.add(role.getCode());
tenantIdToUserRoles.put(role.getTenantId(), roleCodes);
tenantIdToUserRoles.put(role.getTenantId().split("\\.")[0], roleCodes);
}

});
log.info("tenantIdToUserRoles:" + tenantIdToUserRoles.toString());
return tenantIdToUserRoles;
}

Expand Down