use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.
the class QueryInterpreterTest method test218QueryCertCaseReviewerAndEnabled.
@Test
public void test218QueryCertCaseReviewerAndEnabled() throws Exception {
Session session = open();
try {
PrismReferenceValue assigneeRef = ObjectTypeUtil.createObjectRef("1234567890", ObjectTypes.USER).asReferenceValue();
ObjectQuery query = prismContext.queryFor(AccessCertificationCaseType.class).item(F_WORK_ITEM, F_ASSIGNEE_REF).ref(assigneeRef).and().item(AccessCertificationCaseType.F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCampaignType.F_STAGE_NUMBER).build();
String real = getInterpretedQuery(session, AccessCertificationCaseType.class, query, false);
assertThat(real).isEqualToIgnoringWhitespace("select\n" + " a.ownerOid, a.id, a.fullObject\n" + "from\n" + " RAccessCertificationCase a\n" + " left join a.workItems w\n" + " left join w.assigneeRef a2\n" + " left join a.owner o\n" + "where\n" + " (\n" + " (\n" + " a2.targetOid = :targetOid and\n" + " a2.relation in (:relation) and\n" + " a2.targetType = :targetType\n" + " ) and\n" + " (\n" + " a.stageNumber = o.stageNumber or\n" + " (\n" + " a.stageNumber is null and\n" + " o.stageNumber is null\n" + " )\n" + " )\n" + " )\n");
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.
the class QueryInterpreter2Test method test747QueryCertCaseReviewerAndEnabledByRequestedDesc.
@Test
public void test747QueryCertCaseReviewerAndEnabledByRequestedDesc() throws Exception {
Session session = open();
try {
PrismReferenceValue assigneeRef = ObjectTypeUtil.createObjectRef("1234567890", ObjectTypes.USER).asReferenceValue();
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext).item(F_WORK_ITEM, F_ASSIGNEE_REF).ref(assigneeRef).and().item(AccessCertificationCaseType.F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCampaignType.F_STAGE_NUMBER).and().item(T_PARENT, F_STATE).eq(IN_REVIEW_STAGE).desc(F_CURRENT_STAGE_CREATE_TIMESTAMP).build();
String real = getInterpretedQuery2(session, AccessCertificationCaseType.class, query, false);
String expected = "select\n" + " a.ownerOid, a.id, a.fullObject\n" + "from\n" + " RAccessCertificationCase a\n" + " left join a.workItems w\n" + " left join w.assigneeRef a2\n" + " left join a.owner o\n" + "where\n" + " (\n" + " (\n" + " a2.targetOid = :targetOid and\n" + " a2.relation in (:relation) and\n" + " a2.type = :type\n" + " ) and\n" + " (\n" + " a.stageNumber = o.stageNumber or\n" + " (\n" + " a.stageNumber is null and\n" + " o.stageNumber is null\n" + " )\n" + " ) and\n" + " o.state = :state\n" + " )\n" + "order by a.reviewRequestedTimestamp desc";
assertEqualsIgnoreWhitespace(expected, real);
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.
the class QueryInterpreter2Test method test737QueryCertWorkItemReviewersMulti.
@Test
public void test737QueryCertWorkItemReviewersMulti() throws Exception {
Session session = open();
try {
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationWorkItemType.class, prismContext).item(F_ASSIGNEE_REF).ref("oid1", "oid2").build();
String real = getInterpretedQuery2(session, AccessCertificationWorkItemType.class, query, false);
String expected = "select\n" + " a.ownerOwnerOid,\n" + " a.ownerId,\n" + " a.id\n" + "from\n" + " RAccessCertificationWorkItem a\n" + " left join a.assigneeRef a2\n" + "where\n" + " (\n" + " a2.targetOid in (:targetOid) and\n" + " a2.relation in (:relation)\n" + " )";
assertEqualsIgnoreWhitespace(expected, real);
} finally {
close(session);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.
the class TestUserChangeApprovalLegacy method assertWfContextAfterClockworkRun.
protected void assertWfContextAfterClockworkRun(Task rootTask, List<Task> subtasks, OperationResult result, String... processNames) throws Exception {
final Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(new ItemPath(F_WORKFLOW_CONTEXT, F_WORK_ITEM), createRetrieve());
Task opTask = taskManager.createTaskInstance();
TaskType rootTaskType = modelService.getObject(TaskType.class, rootTask.getOid(), options, opTask, result).asObjectable();
display("rootTask", rootTaskType);
assertTrue("unexpected process instance id in root task", rootTaskType.getWorkflowContext() == null || rootTaskType.getWorkflowContext().getProcessInstanceId() == null);
assertEquals("Wrong # of wf subtasks w.r.t processNames (" + Arrays.asList(processNames) + ")", processNames.length, subtasks.size());
int i = 0;
for (Task subtask : subtasks) {
TaskType subtaskType = modelService.getObject(TaskType.class, subtask.getOid(), options, opTask, result).asObjectable();
display("Subtask #" + (i + 1) + ": ", subtaskType);
checkTask(subtaskType, subtask.toString(), processNames[i++]);
WfTestUtil.assertRef("requester ref", subtaskType.getWorkflowContext().getRequesterRef(), USER_ADMINISTRATOR_OID, false, false);
}
final Collection<SelectorOptions<GetOperationOptions>> options1 = resolveItemsNamed(new ItemPath(T_PARENT, F_OBJECT_REF), new ItemPath(T_PARENT, F_TARGET_REF), F_ASSIGNEE_REF, F_ORIGINAL_ASSIGNEE_REF, new ItemPath(T_PARENT, F_REQUESTER_REF));
List<WorkItemType> workItems = modelService.searchContainers(WorkItemType.class, null, options1, opTask, result);
assertEquals("Wrong # of work items", processNames.length, workItems.size());
i = 0;
for (WorkItemType workItem : workItems) {
display("Work item #" + (i + 1) + ": ", workItem);
display("Task ref", WfContextUtil.getTask(workItem));
WfTestUtil.assertRef("object reference", WfContextUtil.getObjectRef(workItem), USER_JACK_OID, true, true);
WfTestUtil.assertRef("target reference", WfContextUtil.getTargetRef(workItem), ROLE_R1_OID, true, true);
// name is not known, as it is not stored in activiti (only OID is)
WfTestUtil.assertRef("assignee reference", workItem.getOriginalAssigneeRef(), R1BOSS_OID, false, true);
//WfTestUtil.assertRef("task reference", workItem.getTaskRef(), null, false, true);
final TaskType subtaskType = WfContextUtil.getTask(workItem);
checkTask(subtaskType, "task in workItem", processNames[i++]);
WfTestUtil.assertRef("requester ref", subtaskType.getWorkflowContext().getRequesterRef(), USER_ADMINISTRATOR_OID, false, true);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.
the class QueryInterpreterTest method test220QueryCertWorkItemReviewersMulti.
@Test
public void test220QueryCertWorkItemReviewersMulti() throws Exception {
Session session = open();
try {
ObjectQuery query = prismContext.queryFor(AccessCertificationWorkItemType.class).item(F_ASSIGNEE_REF).ref("oid1", "oid2").build();
String real = getInterpretedQuery(session, AccessCertificationWorkItemType.class, query, false);
assertThat(real).isEqualToIgnoringWhitespace("select\n" + " a.ownerOwnerOid,\n" + " a.ownerId,\n" + " a.id\n" + "from\n" + " RAccessCertificationWorkItem a\n" + " left join a.assigneeRef a2\n" + "where\n" + " (\n" + " a2.targetOid in (:targetOid) and\n" + " a2.relation in (:relation)\n" + " )");
} finally {
close(session);
}
}
Aggregations