@Test public void test220EqualRightHandItem() throws Exception { final String TEST_NAME = "test220EqualRightHandItem"; displayTestTitle(TEST_NAME); ObjectQuery q = getPrismContext().queryFor(UserType.class) .item(UserType.F_EMPLOYEE_NUMBER).eq().item(UserType.F_COST_CENTER) .build(); checkQueryRoundtripFile(UserType.class, q, TEST_NAME); }
.item(UserType.F_PREFERRED_LANGUAGE).eq().item(UserType.F_COST_CENTER) .build(); String real = getInterpretedQuery2(session, UserType.class, query);
@Test public void test310LessThanItem() throws Exception { PrismObjectDefinition userDef = getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); PrismPropertyDefinition nameDef = userDef.findPropertyDefinition(UserType.F_NAME); PrismPropertyDefinition localityDef = userDef.findPropertyDefinition(UserType.F_LOCALITY); ObjectQuery actual = getPrismContext().queryFor(UserType.class) .item(UserType.F_LOCALITY, localityDef) .le() .item(UserType.F_NAME, nameDef) .build(); ObjectQuery expected = ObjectQueryImpl.createObjectQuery( LessFilterImpl.createLess(UserType.F_LOCALITY, localityDef, null, UserType.F_NAME, nameDef, true) ); compare(actual, expected); }
@Test public void test300EqualItem() throws Exception { ObjectQuery actual = getPrismContext().queryFor(UserType.class) .item(UserType.F_LOCALITY).eq().item(UserType.F_NAME) .build(); PrismContainerDefinition userPcd = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(UserType.class); ObjectQuery expected = ObjectQueryImpl.createObjectQuery( EqualFilterImpl.createEqual( UserType.F_LOCALITY, userPcd.findPropertyDefinition(UserType.F_LOCALITY), null, UserType.F_NAME, null ) ); compare(actual, expected); }
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();
@Test public void test730CurrentUnansweredCases() throws Exception { OperationResult result = new OperationResult("test730CurrentUnansweredCases"); ObjectQuery query = prismContext.queryFor(AccessCertificationCaseType.class) .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])); }
.and().item(AccessCertificationCaseType.F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCampaignType.F_STAGE_NUMBER) .asc(F_CURRENT_STAGE_DEADLINE).asc(T_ID) .build();
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) .and().item(T_PARENT, F_STATE).eq(IN_REVIEW_STAGE) .desc(F_CURRENT_STAGE_CREATE_TIMESTAMP)
.block() .item(F_ASSIGNEE_REF).ref("123456") .and().item(F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCaseType.F_STAGE_NUMBER) .and().item(F_OUTPUT, AbstractWorkItemOutputType.F_OUTCOME).isNull() .endBlock()
.block() .item(F_ASSIGNEE_REF).ref("123456") .and().item(F_STAGE_NUMBER).eq().item(T_PARENT, AccessCertificationCaseType.F_STAGE_NUMBER) .and().item(F_OUTPUT, AbstractWorkItemOutputType.F_OUTCOME).isNull() .endBlock()