Search in sources :

Example 46 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test126ReplaceAssignmentExtensionValues.

@Test
public void test126ReplaceAssignmentExtensionValues() throws Exception {
    OperationResult result = new OperationResult("test126ReplaceAssignmentExtensionValues");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT, 1, AssignmentType.F_EXTENSION, EXT_WEAPON).replace("w2", "w9").asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemHidden1, "h1.1", "h1.2");
        assertExtension(u, itemHidden2);
        assertExtension(u, itemHidden3);
        assertExtension(u, itemVisible, "v1", "v2", "v3");
        assertExtension(u, itemWeapon);
        RAssignment a = u.getAssignments().iterator().next();
        assertExtension(a, itemWeapon, "w2", "w9");
        assertExtension(a, itemShipName, "none");
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
 [1] select assignment0_.owner_oid as owner_oi2_5_0_, assignment0_.id as id1_5_0_, assignment0_.id as id1_5_1_, assignment0_.owner_oid as owner_oi2_5_1_, assignment0_.administrativeStatus as administ3_5_1_, assignment0_.archiveTimestamp as archiveT4_5_1_, assignment0_.disableReason as disableR5_5_1_, assignment0_.disableTimestamp as disableT6_5_1_, assignment0_.effectiveStatus as effectiv7_5_1_, assignment0_.enableTimestamp as enableTi8_5_1_, assignment0_.validFrom as validFro9_5_1_, assignment0_.validTo as validTo10_5_1_, assignment0_.validityChangeTimestamp as validit11_5_1_, assignment0_.validityStatus as validit12_5_1_, assignment0_.assignmentOwner as assignm13_5_1_, assignment0_.createChannel as createC14_5_1_, assignment0_.createTimestamp as createT15_5_1_, assignment0_.creatorRef_relation as creator16_5_1_, assignment0_.creatorRef_targetOid as creator17_5_1_, assignment0_.creatorRef_type as creator18_5_1_, assignment0_.extId as extId38_5_1_, assignment0_.extOid as extOid39_5_1_, assignment0_.lifecycleState as lifecyc19_5_1_, assignment0_.modifierRef_relation as modifie20_5_1_, assignment0_.modifierRef_targetOid as modifie21_5_1_, assignment0_.modifierRef_type as modifie22_5_1_, assignment0_.modifyChannel as modifyC23_5_1_, assignment0_.modifyTimestamp as modifyT24_5_1_, assignment0_.orderValue as orderVa25_5_1_, assignment0_.orgRef_relation as orgRef_26_5_1_, assignment0_.orgRef_targetOid as orgRef_27_5_1_, assignment0_.orgRef_type as orgRef_28_5_1_, assignment0_.resourceRef_relation as resourc29_5_1_, assignment0_.resourceRef_targetOid as resourc30_5_1_, assignment0_.resourceRef_type as resourc31_5_1_, assignment0_.targetRef_relation as targetR32_5_1_, assignment0_.targetRef_targetOid as targetR33_5_1_, assignment0_.targetRef_type as targetR34_5_1_, assignment0_.tenantRef_relation as tenantR35_5_1_, assignment0_.tenantRef_targetOid as tenantR36_5_1_, assignment0_.tenantRef_type as tenantR37_5_1_, rassignmen1_.owner_id as owner_id1_12_2_, rassignmen1_.owner_owner_oid as owner_ow2_12_2_ from m_assignment assignment0_ left outer join m_assignment_extension rassignmen1_ on assignment0_.extId=rassignmen1_.owner_id and assignment0_.extOid=rassignmen1_.owner_owner_oid where assignment0_.owner_oid=?
 [1] select strings0_.anyContainer_owner_id as anyConta2_11_0_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_0_, strings0_.item_id as item_id1_11_0_, strings0_.stringValue as stringVa4_11_0_, strings0_.item_id as item_id1_11_1_, strings0_.anyContainer_owner_id as anyConta2_11_1_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_1_, strings0_.stringValue as stringVa4_11_1_ from m_assignment_ext_string strings0_ where strings0_.anyContainer_owner_id=? and strings0_.anyContainer_owner_owner_oid=?
 [1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
 [1] insert into m_assignment_ext_string (item_id, anyContainer_owner_id, anyContainer_owner_owner_oid, stringValue) values (?, ?, ?, ?)
 [1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
 [4] delete from m_assignment_ext_string where item_id=? and anyContainer_owner_id=? and anyContainer_owner_owner_oid=? and stringValue=?
         */
    assertCounts(8, 11);
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 47 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test028DeleteAlreadyLoadedVisibleExtensionValue.

/**
 * We load extension values (e.g. invoking REPLACE operation) and then try to delete an extension value.
 */
@Test
public void test028DeleteAlreadyLoadedVisibleExtensionValue() throws Exception {
    OperationResult result = new OperationResult("test028DeleteAlreadyLoadedVisibleExtensionValue");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_WEAPON).replace("w1").item(UserType.F_EXTENSION, EXT_VISIBLE).delete("v4", "v5").asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemHidden1, "h1.1", "h1.2", "h1.3");
        assertExtension(u, itemHidden2);
        assertExtension(u, itemHidden3, "h3.1");
        assertExtension(u, itemVisible, "v1", "v2", "v3");
        assertExtension(u, itemWeapon, "w1");
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
 [1] select strings0_.owner_oid as owner_oi2_33_0_, strings0_.item_id as item_id1_33_0_, strings0_.ownerType as ownerTyp3_33_0_, strings0_.stringValue as stringVa4_33_0_, strings0_.item_id as item_id1_33_1_, strings0_.owner_oid as owner_oi2_33_1_, strings0_.ownerType as ownerTyp3_33_1_, strings0_.stringValue as stringVa4_33_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=?
 [1] select roextstrin0_.item_id as item_id1_33_0_, roextstrin0_.owner_oid as owner_oi2_33_0_, roextstrin0_.ownerType as ownerTyp3_33_0_, roextstrin0_.stringValue as stringVa4_33_0_ from m_object_ext_string roextstrin0_ where roextstrin0_.item_id=? and roextstrin0_.owner_oid=? and roextstrin0_.ownerType=? and roextstrin0_.stringValue=?
 [1] insert into m_object_ext_string (item_id, owner_oid, ownerType, stringValue) values (?, ?, ?, ?)
 [1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
 [2] delete from m_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?

        Actually, 4th SELECT probably could be eliminated by letting Hibernate take care of the addition. But let's ignore this for a moment.
         */
    assertCounts(7, 8);
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 48 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test173DeleteAssignment.

@Test
public void test173DeleteAssignment() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test173DeleteAssignment");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).delete(new AssignmentType(prismContext).id(777L)).asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemHidden1, "h1.1", "h1.2");
        assertExtension(u, itemHidden2);
        assertExtension(u, itemHidden3);
        assertExtension(u, itemVisible, "v1", "v2", "v3");
        assertExtension(u, itemWeapon);
        assertEquals("Wrong # of assignments", 2, u.getAssignments().size());
        RAssignment a1 = find(u.getAssignments(), 1);
        RAssignment a3 = find(u.getAssignments(), 888);
        assertExtension(a1, itemWeapon);
        assertExtension(a1, itemShipName);
        assertExtension(a3, itemWeapon, "W3.1", "W3.2");
        assertExtension(a3, itemShipName, "ship3");
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
 [1] select assignment0_.owner_oid as owner_oi2_5_0_, assignment0_.id as id1_5_0_, assignment0_.id as id1_5_1_, assignment0_.owner_oid as owner_oi2_5_1_, assignment0_.administrativeStatus as administ3_5_1_, assignment0_.archiveTimestamp as archiveT4_5_1_, assignment0_.disableReason as disableR5_5_1_, assignment0_.disableTimestamp as disableT6_5_1_, assignment0_.effectiveStatus as effectiv7_5_1_, assignment0_.enableTimestamp as enableTi8_5_1_, assignment0_.validFrom as validFro9_5_1_, assignment0_.validTo as validTo10_5_1_, assignment0_.validityChangeTimestamp as validit11_5_1_, assignment0_.validityStatus as validit12_5_1_, assignment0_.assignmentOwner as assignm13_5_1_, assignment0_.createChannel as createC14_5_1_, assignment0_.createTimestamp as createT15_5_1_, assignment0_.creatorRef_relation as creator16_5_1_, assignment0_.creatorRef_targetOid as creator17_5_1_, assignment0_.creatorRef_type as creator18_5_1_, assignment0_.extId as extId38_5_1_, assignment0_.extOid as extOid39_5_1_, assignment0_.lifecycleState as lifecyc19_5_1_, assignment0_.modifierRef_relation as modifie20_5_1_, assignment0_.modifierRef_targetOid as modifie21_5_1_, assignment0_.modifierRef_type as modifie22_5_1_, assignment0_.modifyChannel as modifyC23_5_1_, assignment0_.modifyTimestamp as modifyT24_5_1_, assignment0_.orderValue as orderVa25_5_1_, assignment0_.orgRef_relation as orgRef_26_5_1_, assignment0_.orgRef_targetOid as orgRef_27_5_1_, assignment0_.orgRef_type as orgRef_28_5_1_, assignment0_.resourceRef_relation as resourc29_5_1_, assignment0_.resourceRef_targetOid as resourc30_5_1_, assignment0_.resourceRef_type as resourc31_5_1_, assignment0_.targetRef_relation as targetR32_5_1_, assignment0_.targetRef_targetOid as targetR33_5_1_, assignment0_.targetRef_type as targetR34_5_1_, assignment0_.tenantRef_relation as tenantR35_5_1_, assignment0_.tenantRef_targetOid as tenantR36_5_1_, assignment0_.tenantRef_type as tenantR37_5_1_, rassignmen1_.owner_id as owner_id1_12_2_, rassignmen1_.owner_owner_oid as owner_ow2_12_2_ from m_assignment assignment0_ left outer join m_assignment_extension rassignmen1_ on assignment0_.extId=rassignmen1_.owner_id and assignment0_.extOid=rassignmen1_.owner_owner_oid where assignment0_.owner_oid=?
 [1] select createappr0_.owner_id as owner_id1_14_0_, createappr0_.owner_owner_oid as owner_ow2_14_0_, createappr0_.reference_type as referenc3_14_0_, createappr0_.relation as relation4_14_0_, createappr0_.targetOid as targetOi5_14_0_, createappr0_.owner_id as owner_id1_14_1_, createappr0_.owner_owner_oid as owner_ow2_14_1_, createappr0_.reference_type as referenc3_14_1_, createappr0_.relation as relation4_14_1_, createappr0_.targetOid as targetOi5_14_1_, createappr0_.targetType as targetTy6_14_1_ from m_assignment_reference createappr0_ where ( createappr0_.reference_type= 0) and createappr0_.owner_id=? and createappr0_.owner_owner_oid=?
 [1] select modifyappr0_.owner_id as owner_id1_14_0_, modifyappr0_.owner_owner_oid as owner_ow2_14_0_, modifyappr0_.reference_type as referenc3_14_0_, modifyappr0_.relation as relation4_14_0_, modifyappr0_.targetOid as targetOi5_14_0_, modifyappr0_.owner_id as owner_id1_14_1_, modifyappr0_.owner_owner_oid as owner_ow2_14_1_, modifyappr0_.reference_type as referenc3_14_1_, modifyappr0_.relation as relation4_14_1_, modifyappr0_.targetOid as targetOi5_14_1_, modifyappr0_.targetType as targetTy6_14_1_ from m_assignment_reference modifyappr0_ where ( modifyappr0_.reference_type= 1) and modifyappr0_.owner_id=? and modifyappr0_.owner_owner_oid=?
 [1] select booleans0_.anyContainer_owner_id as anyConta2_6_0_, booleans0_.anyContainer_owner_owner_oid as anyConta3_6_0_, booleans0_.item_id as item_id1_6_0_, booleans0_.booleanValue as booleanV4_6_0_, booleans0_.item_id as item_id1_6_1_, booleans0_.anyContainer_owner_id as anyConta2_6_1_, booleans0_.anyContainer_owner_owner_oid as anyConta3_6_1_, booleans0_.booleanValue as booleanV4_6_1_ from m_assignment_ext_boolean booleans0_ where booleans0_.anyContainer_owner_id=? and booleans0_.anyContainer_owner_owner_oid=?
 [1] select dates0_.anyContainer_owner_id as anyConta2_7_0_, dates0_.anyContainer_owner_owner_oid as anyConta3_7_0_, dates0_.item_id as item_id1_7_0_, dates0_.dateValue as dateValu4_7_0_, dates0_.item_id as item_id1_7_1_, dates0_.anyContainer_owner_id as anyConta2_7_1_, dates0_.anyContainer_owner_owner_oid as anyConta3_7_1_, dates0_.dateValue as dateValu4_7_1_ from m_assignment_ext_date dates0_ where dates0_.anyContainer_owner_id=? and dates0_.anyContainer_owner_owner_oid=?
 [1] select longs0_.anyContainer_owner_id as anyConta2_8_0_, longs0_.anyContainer_owner_owner_oid as anyConta3_8_0_, longs0_.item_id as item_id1_8_0_, longs0_.longValue as longValu4_8_0_, longs0_.item_id as item_id1_8_1_, longs0_.anyContainer_owner_id as anyConta2_8_1_, longs0_.anyContainer_owner_owner_oid as anyConta3_8_1_, longs0_.longValue as longValu4_8_1_ from m_assignment_ext_long longs0_ where longs0_.anyContainer_owner_id=? and longs0_.anyContainer_owner_owner_oid=?
 [1] select polys0_.anyContainer_owner_id as anyConta2_9_0_, polys0_.anyContainer_owner_owner_oid as anyConta3_9_0_, polys0_.item_id as item_id1_9_0_, polys0_.orig as orig4_9_0_, polys0_.item_id as item_id1_9_1_, polys0_.anyContainer_owner_id as anyConta2_9_1_, polys0_.anyContainer_owner_owner_oid as anyConta3_9_1_, polys0_.orig as orig4_9_1_, polys0_.norm as norm5_9_1_ from m_assignment_ext_poly polys0_ where polys0_.anyContainer_owner_id=? and polys0_.anyContainer_owner_owner_oid=?
 [1] select references0_.anyContainer_owner_id as anyConta2_10_0_, references0_.anyContainer_owner_owner_oid as anyConta3_10_0_, references0_.item_id as item_id1_10_0_, references0_.targetoid as targetoi4_10_0_, references0_.item_id as item_id1_10_1_, references0_.anyContainer_owner_id as anyConta2_10_1_, references0_.anyContainer_owner_owner_oid as anyConta3_10_1_, references0_.targetoid as targetoi4_10_1_, references0_.relation as relation5_10_1_, references0_.targetType as targetTy6_10_1_ from m_assignment_ext_reference references0_ where references0_.anyContainer_owner_id=? and references0_.anyContainer_owner_owner_oid=?
 [1] select strings0_.anyContainer_owner_id as anyConta2_11_0_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_0_, strings0_.item_id as item_id1_11_0_, strings0_.stringValue as stringVa4_11_0_, strings0_.item_id as item_id1_11_1_, strings0_.anyContainer_owner_id as anyConta2_11_1_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_1_, strings0_.stringValue as stringVa4_11_1_ from m_assignment_ext_string strings0_ where strings0_.anyContainer_owner_id=? and strings0_.anyContainer_owner_owner_oid=?
 [1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
 [1] delete from m_assignment_policy_situation where assignment_id=? and assignment_oid=?
 [1] delete from m_assignment where id=? and owner_oid=?
 [3] delete from m_assignment_ext_string where item_id=? and anyContainer_owner_id=? and anyContainer_owner_owner_oid=? and stringValue=?
 [1] delete from m_assignment_extension where owner_id=? and owner_owner_oid=?
          */
    assertCounts(16, 18);
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 49 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test125AddAssignmentExtensionValueDuplicate.

@Test
public void test125AddAssignmentExtensionValueDuplicate() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test125AddAssignmentExtensionValueDuplicate");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT, 1, AssignmentType.F_EXTENSION, EXT_WEAPON).add("w4").asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemHidden1, "h1.1", "h1.2");
        assertExtension(u, itemHidden2);
        assertExtension(u, itemHidden3);
        assertExtension(u, itemVisible, "v1", "v2", "v3");
        assertExtension(u, itemWeapon);
        RAssignment a = u.getAssignments().iterator().next();
        assertExtension(a, itemWeapon, "w1", "w2", "w3", "w4", "w5");
        assertExtension(a, itemShipName, "none");
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
 [1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
         */
    assertCounts(3, 3);
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 50 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test058AddWholeExtensionDifferentValue.

/**
 * This is really tricky. We try to add another value to single-valued extension container.
 */
@Test
public void test058AddWholeExtensionDifferentValue() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test055AddWholeExtension");
    PrismContainerValue<?> extValue = expectedUser.getDefinition().getExtensionDefinition().instantiate().getValue();
    extValue.findOrCreateProperty(EXT_HIDDEN1).addRealValues("H1:100");
    extValue.findOrCreateProperty(EXT_VISIBLE).addRealValues("V3");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION).add(extValue.clone()).asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemHidden1, "H1:100");
        assertExtension(u, itemHidden2);
        assertExtension(u, itemHidden3);
        assertExtension(u, itemVisible, "V3");
        assertExtension(u, itemWeapon);
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
 [1] select booleans0_.owner_oid as owner_oi2_28_0_, booleans0_.item_id as item_id1_28_0_, booleans0_.ownerType as ownerTyp3_28_0_, booleans0_.booleanValue as booleanV4_28_0_, booleans0_.item_id as item_id1_28_1_, booleans0_.owner_oid as owner_oi2_28_1_, booleans0_.ownerType as ownerTyp3_28_1_, booleans0_.booleanValue as booleanV4_28_1_ from m_object_ext_boolean booleans0_ where booleans0_.owner_oid=?
 [1] select dates0_.owner_oid as owner_oi2_29_0_, dates0_.item_id as item_id1_29_0_, dates0_.ownerType as ownerTyp3_29_0_, dates0_.dateValue as dateValu4_29_0_, dates0_.item_id as item_id1_29_1_, dates0_.owner_oid as owner_oi2_29_1_, dates0_.ownerType as ownerTyp3_29_1_, dates0_.dateValue as dateValu4_29_1_ from m_object_ext_date dates0_ where dates0_.owner_oid=?
 [1] select longs0_.owner_oid as owner_oi2_30_0_, longs0_.item_id as item_id1_30_0_, longs0_.ownerType as ownerTyp3_30_0_, longs0_.longValue as longValu4_30_0_, longs0_.item_id as item_id1_30_1_, longs0_.owner_oid as owner_oi2_30_1_, longs0_.ownerType as ownerTyp3_30_1_, longs0_.longValue as longValu4_30_1_ from m_object_ext_long longs0_ where longs0_.owner_oid=?
 [1] select polys0_.owner_oid as owner_oi2_31_0_, polys0_.item_id as item_id1_31_0_, polys0_.ownerType as ownerTyp3_31_0_, polys0_.orig as orig4_31_0_, polys0_.item_id as item_id1_31_1_, polys0_.owner_oid as owner_oi2_31_1_, polys0_.ownerType as ownerTyp3_31_1_, polys0_.orig as orig4_31_1_, polys0_.norm as norm5_31_1_ from m_object_ext_poly polys0_ where polys0_.owner_oid=?
 [1] select references0_.owner_oid as owner_oi2_32_0_, references0_.item_id as item_id1_32_0_, references0_.ownerType as ownerTyp3_32_0_, references0_.targetoid as targetoi4_32_0_, references0_.item_id as item_id1_32_1_, references0_.owner_oid as owner_oi2_32_1_, references0_.ownerType as ownerTyp3_32_1_, references0_.targetoid as targetoi4_32_1_, references0_.relation as relation5_32_1_, references0_.targetType as targetTy6_32_1_ from m_object_ext_reference references0_ where references0_.owner_oid=?
 [1] select strings0_.owner_oid as owner_oi2_33_0_, strings0_.item_id as item_id1_33_0_, strings0_.ownerType as ownerTyp3_33_0_, strings0_.stringValue as stringVa4_33_0_, strings0_.item_id as item_id1_33_1_, strings0_.owner_oid as owner_oi2_33_1_, strings0_.ownerType as ownerTyp3_33_1_, strings0_.stringValue as stringVa4_33_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=?
 [2] insert into m_object_ext_string (item_id, owner_oid, ownerType, stringValue) values (?, ?, ?, ?)
 [1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
 [5] delete from m_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?
         */
    assertCounts(11 + getExtraSafeInsertionSelects(2), 16 + getExtraSafeInsertionSelects(2));
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Aggregations

RUser (com.evolveum.midpoint.repo.sql.data.common.RUser)56 Session (org.hibernate.Session)56 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)55 Test (org.testng.annotations.Test)55 RAssignment (com.evolveum.midpoint.repo.sql.data.common.container.RAssignment)19 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)15 RFocusPhoto (com.evolveum.midpoint.repo.sql.data.common.RFocusPhoto)3 RActivation (com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 RAssignmentExtension (com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension)1 RPolyString (com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString)1 File (java.io.File)1 QName (javax.xml.namespace.QName)1