Search in sources :

Example 1 with RShadow

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

the class ExtensionTest method test427DeleteVisibleAttributeValues.

@Test
public void test427DeleteVisibleAttributeValues() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test427DeleteVisibleAttributeValues");
    ObjectDelta<ShadowType> delta = getPrismContext().deltaFor(ShadowType.class).item(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR_GROUP_NAME), attrGroupNameDefinition).delete("alumni").asObjectDelta("");
    delta.applyTo(expectedShadow);
    queryListener.start();
    repositoryService.modifyObject(ShadowType.class, shadowOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RShadow s = session.get(RShadow.class, shadowOid);
        assertExtension(s, itemGroupName);
        assertExtension(s, itemMember, "banderson", "kwhite");
        assertExtension(s, itemManager, "bob", "chuck");
    }
    assertGetShadow(result);
    /*

 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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] 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_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?

        no fetch deletion:

 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.oid=?
 [1] delete from m_object_ext_string where owner_oid=? and ownerType=? and item_id=? and stringValue=?
 [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=?
         */
    if (isNoFetchDeletion()) {
        assertCounts(4, 4);
    } else {
        assertCounts(5, 5);
    }
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RShadow(com.evolveum.midpoint.repo.sql.data.common.RShadow) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 2 with RShadow

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

the class ExtensionTest method test420AddVisibleAttributeValues.

@Test
public void test420AddVisibleAttributeValues() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test420AddVisibleAttributeValues");
    ObjectDelta<ShadowType> delta = getPrismContext().deltaFor(ShadowType.class).item(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR_MANAGER), attrManagerDefinition).add("alice", "bob").asObjectDelta("");
    delta.applyTo(expectedShadow);
    queryListener.start();
    repositoryService.modifyObject(ShadowType.class, shadowOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RShadow s = session.get(RShadow.class, shadowOid);
        assertExtension(s, itemGroupName, "alumni");
        assertExtension(s, itemMember, "banderson", "kwhite");
        assertExtension(s, itemManager, "jack", "jim", "alice", "bob");
    }
    assertGetShadow(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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=?

        safe insertions:

 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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] 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=?
 [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=?
         */
    assertCounts(4 + getExtraSafeInsertionSelects(2), 5 + getExtraSafeInsertionSelects(2));
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RShadow(com.evolveum.midpoint.repo.sql.data.common.RShadow) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 3 with RShadow

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

the class ExtensionTest method test426ReplaceVisibleAttributeValues.

@Test
public void test426ReplaceVisibleAttributeValues() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test426ReplaceVisibleAttributeValues");
    ObjectDelta<ShadowType> delta = getPrismContext().deltaFor(ShadowType.class).item(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR_MANAGER), attrManagerDefinition).replace("bob", "chuck").asObjectDelta("");
    delta.applyTo(expectedShadow);
    queryListener.start();
    repositoryService.modifyObject(ShadowType.class, shadowOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RShadow s = session.get(RShadow.class, shadowOid);
        assertExtension(s, itemGroupName, "alumni");
        assertExtension(s, itemMember, "banderson", "kwhite");
        assertExtension(s, itemManager, "bob", "chuck");
    }
    assertGetShadow(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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=?
 [3] delete from m_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?
         */
    assertCounts(7, 9);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RShadow(com.evolveum.midpoint.repo.sql.data.common.RShadow) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 4 with RShadow

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

the class ExtensionTest method test440ReplaceHiddenAttributeValues.

@Test
public void test440ReplaceHiddenAttributeValues() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test440ReplaceHiddenAttributeValues");
    ObjectDelta<ShadowType> delta = getPrismContext().deltaFor(ShadowType.class).item(ItemPath.create(ShadowType.F_ATTRIBUTES, ATTR_MEMBER), attrMemberDefinition).replace("alice", "bob").asObjectDelta("");
    delta.applyTo(expectedShadow);
    queryListener.start();
    repositoryService.modifyObject(ShadowType.class, shadowOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RShadow s = session.get(RShadow.class, shadowOid);
        assertExtension(s, itemGroupName, "ALUMNI");
        assertExtension(s, itemMember, "alice", "bob");
        assertExtension(s, itemManager, "chuck");
    }
    assertGetObject(result);
    /*
         safe insertions (can be improved)

 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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] 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=?
 [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=?
 [2] delete from m_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?
         */
    assertCounts(8, 10);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RShadow(com.evolveum.midpoint.repo.sql.data.common.RShadow) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 5 with RShadow

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

the class ExtensionTest method test455AddWholeContainer.

@Test
public void test455AddWholeContainer() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test455AddWholeContainer");
    // just for sure
    expectedShadow.getValue().removeContainer(ShadowType.F_ATTRIBUTES);
    PrismContainer<?> attributesContainer = shadowAttributesDefinition.instantiate();
    PrismContainerValue<?> attributes = attributesContainer.getValue();
    ResourceAttribute<String> name = attrGroupNameDefinition.instantiate();
    name.setRealValue("alumni");
    attributes.add(name);
    ResourceAttribute<String> member = attrMemberDefinition.instantiate();
    member.addRealValues("banderson", "kwhite");
    attributes.add(member);
    ResourceAttribute<String> manager = attrManagerDefinition.instantiate();
    manager.addRealValues("jack", "jim");
    attributes.add(manager);
    ObjectDelta<ShadowType> delta = getPrismContext().deltaFor(ShadowType.class).item(ShadowType.F_ATTRIBUTES).add(attributes.clone()).asObjectDelta("");
    delta.applyTo(expectedShadow);
    queryListener.start();
    repositoryService.modifyObject(ShadowType.class, shadowOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    try (Session session = factory.openSession()) {
        RShadow s = session.get(RShadow.class, shadowOid);
        assertExtension(s, itemGroupName, "alumni");
        assertExtension(s, itemMember, "banderson", "kwhite");
        assertExtension(s, itemManager, "jack", "jim");
    }
    assertGetObject(result);
    /*
 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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=?
 [5] 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=?

        safe insertions (can be improved)

 [1] select oid from m_object where oid = ? for update
 [1] select rshadow0_.oid as oid1_27_, rshadow0_1_.createChannel as createCh2_27_, rshadow0_1_.createTimestamp as createTi3_27_, rshadow0_1_.creatorRef_relation as creatorR4_27_, rshadow0_1_.creatorRef_targetOid as creatorR5_27_, rshadow0_1_.creatorRef_type as creatorR6_27_, rshadow0_1_.fullObject as fullObje7_27_, rshadow0_1_.lifecycleState as lifecycl8_27_, rshadow0_1_.modifierRef_relation as modifier9_27_, rshadow0_1_.modifierRef_targetOid as modifie10_27_, rshadow0_1_.modifierRef_type as modifie11_27_, rshadow0_1_.modifyChannel as modifyC12_27_, rshadow0_1_.modifyTimestamp as modifyT13_27_, rshadow0_1_.name_norm as name_no14_27_, rshadow0_1_.name_orig as name_or15_27_, rshadow0_1_.objectTypeClass as objectT16_27_, rshadow0_1_.tenantRef_relation as tenantR17_27_, rshadow0_1_.tenantRef_targetOid as tenantR18_27_, rshadow0_1_.tenantRef_type as tenantR19_27_, rshadow0_1_.version as version20_27_, rshadow0_.attemptNumber as attemptN1_41_, rshadow0_.dead as dead2_41_, rshadow0_.exist as exist3_41_, rshadow0_.failedOperationType as failedOp4_41_, rshadow0_.fullSynchronizationTimestamp as fullSync5_41_, rshadow0_.intent as intent6_41_, rshadow0_.kind as kind7_41_, rshadow0_.name_norm as name_nor8_41_, rshadow0_.name_orig as name_ori9_41_, rshadow0_.objectClass as objectC10_41_, rshadow0_.pendingOperationCount as pending11_41_, rshadow0_.primaryIdentifierValue as primary12_41_, rshadow0_.resourceRef_relation as resourc13_41_, rshadow0_.resourceRef_targetOid as resourc14_41_, rshadow0_.resourceRef_type as resourc15_41_, rshadow0_.status as status16_41_, rshadow0_.synchronizationSituation as synchro17_41_, rshadow0_.synchronizationTimestamp as synchro18_41_ from m_shadow rshadow0_ inner join m_object rshadow0_1_ on rshadow0_.oid=rshadow0_1_.oid where rshadow0_.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=?
 [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] 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] 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] 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] 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=?
 [5] 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=?
         */
    assertCounts(10 + getExtraSafeInsertionSelects(5), 14 + getExtraSafeInsertionSelects(5));
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RShadow(com.evolveum.midpoint.repo.sql.data.common.RShadow) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Aggregations

RShadow (com.evolveum.midpoint.repo.sql.data.common.RShadow)18 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 Session (org.hibernate.Session)16 Test (org.testng.annotations.Test)16 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 RObject (com.evolveum.midpoint.repo.sql.data.common.RObject)1 PrismIdentifierGenerator (com.evolveum.midpoint.repo.sql.util.PrismIdentifierGenerator)1 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)1