diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/self/PageSelfDashboard.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/self/PageSelfDashboard.java index ff2047bbf07..10dee92f0a0 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/self/PageSelfDashboard.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/self/PageSelfDashboard.java @@ -8,6 +8,7 @@ import static com.evolveum.midpoint.prism.PrismConstants.T_PARENT; import static com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_CREATE_TIMESTAMP; +import static java.util.Collections.emptyList; import java.util.*; @@ -177,9 +178,8 @@ protected SecurityContextAwareCallable>> c private static final long serialVersionUID = 1L; @Override - public CallableResult> callWithContextPrepared() throws Exception { - setupContext(application, session); // TODO is this correct? [med] - return loadWorkItems(); + public CallableResult> callWithContextPrepared() { + return new CallableResult<>(emptyList(), null); // it is ignored anyway - FIXME } }; } @@ -229,9 +229,8 @@ protected SecurityContextAwareCallable>> createCal private static final long serialVersionUID = 1L; @Override - public CallableResult> callWithContextPrepared() throws Exception { - setupContext(application, session); - return loadMyRequests(); + public CallableResult> callWithContextPrepared() { + return new CallableResult<>(emptyList(), null); // it is ignored anyway - FIXME } }; } @@ -274,99 +273,6 @@ public boolean isVisible() { initAssignments(); } - private CallableResult> loadWorkItems() { - - LOGGER.debug("Loading work items."); - - AccountCallableResult callableResult = new AccountCallableResult(); - List list = new ArrayList<>(); - callableResult.setValue(list); - - if (!getWorkflowManager().isEnabled()) { - return callableResult; - } - - PrismObject user = principalModel.getObject(); - if (user == null) { - return callableResult; - } - - Task task = createSimpleTask(OPERATION_LOAD_WORK_ITEMS); - OperationResult result = task.getResult(); - callableResult.setResult(result); - - try { - // TODO try to use current state (user) instead of potentially obsolete principal - // but this requires some computation (of deputy relation) - // (Note that the current code is consistent with the other places where work items are displayed.) - S_FilterEntryOrEmpty q = getPrismContext().queryFor(CaseWorkItemType.class); - ObjectQuery query = QueryUtils.filterForAssignees(q, SecurityUtils.getPrincipalUser(), - OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, getRelationRegistry()) - .desc(F_CREATE_TIMESTAMP) - .build(); - Collection> options = getOperationOptionsBuilder() - .item(T_PARENT, CaseType.F_OBJECT_REF).resolve() - .item(T_PARENT, CaseType.F_TARGET_REF).resolve() - .build(); - List workItems = getModelService().searchContainers(CaseWorkItemType.class, query, options, task, result); - callableResult.setValue(workItems); - } catch (Exception e) { - result.recordFatalError(getString("PageSelfDashboard.message.loadWorkItems.fatalError"), e); - } - - result.recordSuccessIfUnknown(); - result.recomputeStatus(); - - LOGGER.debug("Finished work items loading."); - - return callableResult; - } - - private CallableResult> loadMyRequests() { - - LOGGER.debug("Loading requests."); - - AccountCallableResult> callableResult = new AccountCallableResult<>(); - List list = new ArrayList<>(); - callableResult.setValue(list); - - if (!getWorkflowManager().isEnabled()) { - return callableResult; - } - - PrismObject user = principalModel.getObject(); - if (user == null) { - return callableResult; - } - - Task task = createSimpleTask(OPERATION_LOAD_REQUESTS); - OperationResult result = task.getResult(); - callableResult.setResult(result); - - try { - S_FilterEntryOrEmpty q = getPrismContext().queryFor(CaseType.class); - ObjectQuery query = QueryUtils.filterForMyRequests(q, user.getOid()) - .build(); - Collection> options = getOperationOptionsBuilder() - .item(CaseType.F_OBJECT_REF).resolve() - .item(CaseType.F_TARGET_REF).resolve() - .build(); - List> cases = getModelService().searchObjects(CaseType.class, query, options, task, result); - cases.forEach(caseObj -> list.add(caseObj.asObjectable())); - callableResult.setValue(list); - } catch (Exception e) { - result.recordFatalError(getString("PageSelfDashboard.message.loadWorkItems.fatalError"), e); - } - - result.recordSuccessIfUnknown(); - result.recomputeStatus(); - - LOGGER.debug("Finished requests loading."); - - return callableResult; - } - - private PrismObject loadUser() { MidPointPrincipal principal = SecurityUtils.getPrincipalUser(); Validate.notNull(principal, "No principal");