Search in sources :

Example 6 with RExtItem

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

the class ExtensionTest method test029ReplaceNonIndexedExtensionProperty.

@Test
public void test029ReplaceNonIndexedExtensionProperty() throws Exception {
    OperationResult result = new OperationResult("test029ReplaceNonIndexedExtensionProperty");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_LOOT).replace(34).asObjectDelta("");
    delta.applyTo(expectedUser);
    queryListener.start();
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
    queryListener.dumpAndStop();
    RExtItem extItemDef = extItemDictionary.findItemByDefinition(delta.getModifications().iterator().next().getDefinition());
    assertNull("ext item definition for loot exists", extItemDef);
    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 : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RExtItem(com.evolveum.midpoint.repo.sql.data.common.any.RExtItem) Test(org.testng.annotations.Test)

Example 7 with RExtItem

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

the class ExtItemDictionary method fetchItemsAttempt.

private void fetchItemsAttempt() {
    Session session = null;
    try {
        session = baseHelper.beginReadOnlyTransaction();
        CriteriaQuery<RExtItem> query = session.getCriteriaBuilder().createQuery(RExtItem.class);
        query.select(query.from(RExtItem.class));
        List<RExtItem> items = session.createQuery(query).getResultList();
        LOGGER.debug("Fetched {} item definitions", items.size());
        itemsById = new ConcurrentHashMap<>(items.size());
        itemsByKey = new ConcurrentHashMap<>(items.size());
        for (RExtItem item : items) {
            itemsById.put(item.getId(), item);
            itemsByKey.put(item.toKey(), item);
        }
        session.getTransaction().commit();
    } catch (RuntimeException ex) {
        LOGGER.debug("Exception fetch: {}", ex.getMessage());
        baseHelper.handleGeneralException(ex, session, null);
    } finally {
        baseHelper.cleanupSessionAndResult(session, null);
    }
}
Also used : RExtItem(com.evolveum.midpoint.repo.sql.data.common.any.RExtItem) Session(org.hibernate.Session)

Aggregations

RExtItem (com.evolveum.midpoint.repo.sql.data.common.any.RExtItem)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Test (org.testng.annotations.Test)3 ArrayList (java.util.ArrayList)2 Session (org.hibernate.Session)2 MutablePrismPropertyDefinition (com.evolveum.midpoint.prism.MutablePrismPropertyDefinition)1 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)1 RestartOperationRequestedException (com.evolveum.midpoint.repo.sql.RestartOperationRequestedException)1 RObject (com.evolveum.midpoint.repo.sql.data.common.RObject)1 ExtItemDictionary (com.evolveum.midpoint.repo.sql.data.common.dictionary.ExtItemDictionary)1 AndCondition (com.evolveum.midpoint.repo.sql.query.hqm.condition.AndCondition)1 Condition (com.evolveum.midpoint.repo.sql.query.hqm.condition.Condition)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1 Contract (org.jetbrains.annotations.Contract)1