Skip to content

Commit

Permalink
Add work items report (MID-4733)
Browse files Browse the repository at this point in the history
Along With necessary report functions and utils.
  • Loading branch information
mederly committed Jun 13, 2018
1 parent f4a6e45 commit 966d120
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
Expand Up @@ -426,10 +426,34 @@ public static ObjectReferenceType getObjectRef(WorkItemType workItem) {
return getWorkflowContext(workItem).getObjectRef();
}

public static ObjectReferenceType getObjectRef(PrismContainerValue<WorkItemType> workItem) {
return getObjectRef(workItem.asContainerable());
}

public static ObjectReferenceType getTargetRef(WorkItemType workItem) {
return getWorkflowContext(workItem).getTargetRef();
}

public static ObjectReferenceType getTargetRef(PrismContainerValue<WorkItemType> workItem) {
return getTargetRef(workItem.asContainerable());
}

public static ObjectReferenceType getRequesterRef(WorkItemType workItem) {
return getWorkflowContext(workItem).getRequesterRef();
}

public static ObjectReferenceType getRequesterRef(PrismContainerValue<WorkItemType> workItem) {
return getRequesterRef(workItem.asContainerable());
}

public static XMLGregorianCalendar getStartTimestamp(WorkItemType workItem) {
return getWorkflowContext(workItem).getStartTimestamp();
}

public static XMLGregorianCalendar getStartTimestamp(PrismContainerValue<WorkItemType> workItem) {
return getStartTimestamp(workItem.asContainerable());
}

public static int getEscalationLevelNumber(AbstractWorkItemType workItem) {
return getEscalationLevelNumber(workItem.getEscalationLevel());
}
Expand Down
Expand Up @@ -25,10 +25,7 @@
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.ResultHandler;
import com.evolveum.midpoint.schema.RetrieveOption;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.*;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
Expand All @@ -52,6 +49,7 @@
import java.util.Objects;
import java.util.stream.Collectors;

import static com.evolveum.midpoint.schema.GetOperationOptions.resolveItemsNamed;
import static com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType.CLOSED;
import static com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType.F_STATE;
import static com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType.F_NAME;
Expand Down Expand Up @@ -336,6 +334,20 @@ <C extends Containerable, T> ObjectFilter createEqualFilter(ItemPath propertyPat
// return prismContext.parserFor(xml).xml().parseAnyData();
// }

public List<PrismContainerValue<WorkItemType>> searchApprovalWorkItems()
throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException,
ConfigurationException, ExpressionEvaluationException {
Task task = taskManager.createTaskInstance();
OperationResult result = task.getResult();
SearchResultList<WorkItemType> workItems = model.searchContainers(WorkItemType.class, null,
resolveItemsNamed(
WorkItemType.F_ASSIGNEE_REF,
new ItemPath(PrismConstants.T_PARENT, WfContextType.F_OBJECT_REF),
new ItemPath(PrismConstants.T_PARENT, WfContextType.F_TARGET_REF),
new ItemPath(PrismConstants.T_PARENT, WfContextType.F_REQUESTER_REF)), task, result);
return PrismContainerValue.toPcvList(workItems);
}

/**
* Retrieves all definitions.
* Augments them by count of campaigns (all + open ones).
Expand Down

0 comments on commit 966d120

Please sign in to comment.