Search in sources :

Example 1 with F_WORK_ITEM

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType.F_WORK_ITEM in project midpoint by Evolveum.

the class QueryInterpreter2Test method test920DecisionsNotAnswered.

@Test
public void test920DecisionsNotAnswered() throws Exception {
    Session session = open();
    try {
        /*
             * ### AccCertCase: Exists (decision: assigneeRef = XYZ and stage = ../stage and response is null or response = NO_RESPONSE)
             */
        ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext).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 = getInterpretedQuery2(session, AccessCertificationCaseType.class, query);
        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" + "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";
        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 2 with F_WORK_ITEM

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType.F_WORK_ITEM in project midpoint by Evolveum.

the class QueryInterpreter2Test method test745QueryCertCaseReviewerAndEnabledByDeadlineAndOidAsc.

@Test
public void test745QueryCertCaseReviewerAndEnabledByDeadlineAndOidAsc() 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).asc(F_CURRENT_STAGE_DEADLINE).asc(T_ID).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" + "order by a.reviewDeadline asc, a.id asc\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 3 with F_WORK_ITEM

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType.F_WORK_ITEM in project midpoint by Evolveum.

the class QueryInterpreter2Test method test730QueryCertCaseReviewer.

@Test
public void test730QueryCertCaseReviewer() throws Exception {
    Session session = open();
    try {
        ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext).item(F_WORK_ITEM, F_ASSIGNEE_REF).ref("1234567890").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" + "where\n" + "  (\n" + "    a2.targetOid = :targetOid and\n" + "    a2.relation in (:relation)\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 4 with F_WORK_ITEM

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType.F_WORK_ITEM 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 5 with F_WORK_ITEM

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType.F_WORK_ITEM 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)

Aggregations

AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)15 Session (org.hibernate.Session)10 Test (org.testng.annotations.Test)10 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)3 Task (com.evolveum.midpoint.task.api.Task)3 WorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType)3 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 MidPointPrincipal (com.evolveum.midpoint.security.api.MidPointPrincipal)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 CaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1 WfContextType (com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)1