use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType.F_STATE in project midpoint by Evolveum.
the class CertificationTest method test730CurrentUnansweredCases.
@Test
public void test730CurrentUnansweredCases() throws Exception {
OperationResult result = new OperationResult("test730CurrentUnansweredCases");
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext).item(AccessCertificationCaseType.F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCampaignType.F_STAGE_NUMBER).and().item(T_PARENT, F_STATE).eq(IN_REVIEW_STAGE).and().exists(F_WORK_ITEM).block().item(F_CLOSE_TIMESTAMP).isNull().and().block().item(F_OUTPUT, F_OUTCOME).isNull().endBlock().endBlock().build();
List<AccessCertificationCaseType> cases = repositoryService.searchContainers(AccessCertificationCaseType.class, query, createCollection(createDistinct()), result);
AccessCertificationCampaignType campaign1 = getFullCampaign(campaign1Oid, result).asObjectable();
AccessCertificationCampaignType campaign2 = getFullCampaign(campaign2Oid, result).asObjectable();
List<AccessCertificationCaseType> expectedCases = new ArrayList<>();
addUnansweredActiveCases(expectedCases, campaign1.getCase(), campaign1);
addUnansweredActiveCases(expectedCases, campaign2.getCase(), campaign2);
PrismAsserts.assertEqualsCollectionUnordered("list of cases is different", cases, expectedCases.toArray(new AccessCertificationCaseType[0]));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType.F_STATE 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);
}
}
Aggregations