Search in sources :

Example 6 with F_ASSIGNEE_REF

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.

the class QueryInterpreter2Test method test735QueryCertCaseReviewerAndEnabled.

@Test
public void test735QueryCertCaseReviewerAndEnabled() 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).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" + "    )\n" + "  )\n";
        assertEqualsIgnoreWhitespace(expected, real);
    } finally {
        close(session);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 7 with F_ASSIGNEE_REF

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.

the class QueryInterpreterTest method test234QueryCertCaseReviewerAndEnabledByRequestedDesc.

@Test
public void test234QueryCertCaseReviewerAndEnabledByRequestedDesc() 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).and().item(T_PARENT, F_STATE).eq(IN_REVIEW_STAGE).desc(F_CURRENT_STAGE_CREATE_TIMESTAMP).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" + "    ) and\n" + "    o.state = :state\n" + "  )\n" + "order by a.reviewRequestedTimestamp desc");
    } finally {
        close(session);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 8 with F_ASSIGNEE_REF

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.

the class QueryInterpreterTest method test210QueryCertCaseReviewer.

@Test
public void test210QueryCertCaseReviewer() throws Exception {
    Session session = open();
    try {
        ObjectQuery query = prismContext.queryFor(AccessCertificationCaseType.class).item(F_WORK_ITEM, F_ASSIGNEE_REF).ref("1234567890").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" + "where\n" + "  (\n" + "    a2.targetOid = :targetOid and\n" + "    a2.relation in (:relation)\n" + "  )\n");
    } finally {
        close(session);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 9 with F_ASSIGNEE_REF

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.

the class QueryInterpreterTest method test230QueryCertCaseReviewerAndEnabledByDeadlineAndOidAsc.

@Test
public void test230QueryCertCaseReviewerAndEnabledByDeadlineAndOidAsc() 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).asc(F_CURRENT_STAGE_DEADLINE).asc(T_ID).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" + "order by a.reviewDeadline asc, a.id asc\n");
    } finally {
        close(session);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 10 with F_ASSIGNEE_REF

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF in project midpoint by Evolveum.

the class QueryInterpreterTest method test560DecisionsNotAnswered.

@Test
public void test560DecisionsNotAnswered() throws Exception {
    Session session = open();
    try {
        /*
             * ### AccCertCase: Exists (decision: assigneeRef = XYZ and stage = ../stage and response is null or response = NO_RESPONSE)
             */
        ObjectQuery query = prismContext.queryFor(AccessCertificationCaseType.class).exists(F_WORK_ITEM).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().build();
        String real = getInterpretedQuery(session, AccessCertificationCaseType.class, query);
        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" + "where\n" + "  (\n" + "    (\n" + "      a2.targetOid = :targetOid and\n" + "      a2.relation in (:relation)\n" + "    ) and\n" + "    (\n" + "      w.stageNumber = a.stageNumber or\n" + "      (\n" + "        w.stageNumber is null and\n" + "        a.stageNumber is null\n" + "      )\n" + "    ) and\n" + "      w.outcome is null\n" + "  )\n");
    } finally {
        close(session);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Aggregations

Session (org.hibernate.Session)12 Test (org.testng.annotations.Test)12 AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)10 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)4 Task (com.evolveum.midpoint.task.api.Task)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 WorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType)3 HookOperationMode (com.evolveum.midpoint.model.api.hooks.HookOperationMode)2 AccessCertificationWorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType)2 ModelContext (com.evolveum.midpoint.model.api.context.ModelContext)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 CaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)1 F_ASSIGNEE_REF (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ASSIGNEE_REF)1 F_ORIGINAL_ASSIGNEE_REF (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType.F_ORIGINAL_ASSIGNEE_REF)1