From 4737268755106a4b5aa2af2f059a575829a25035 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 29 Jul 2019 17:37:53 +0200 Subject: [PATCH] Fix indexOnly attribute storage strategy name --- .../common/refinery/RefinedAttributeDefinitionImpl.java | 2 +- .../main/resources/xml/ns/public/common/common-core-3.xsd | 2 +- .../midpoint/repo/sql/helpers/ObjectRetriever.java | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinitionImpl.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinitionImpl.java index 0a289b51cab..e7c26db0575 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinitionImpl.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinitionImpl.java @@ -412,7 +412,7 @@ static RefinedAttributeDefinition parse(ResourceAttributeDefinition sc if (schemaHandlingAttrDefType != null) { rAttrDef.fetchStrategy = schemaHandlingAttrDefType.getFetchStrategy(); rAttrDef.storageStrategy = schemaHandlingAttrDefType.getStorageStrategy(); - rAttrDef.setIndexOnly(rAttrDef.storageStrategy == AttributeStorageStrategyType.QUERY_ONLY); + rAttrDef.setIndexOnly(rAttrDef.storageStrategy == AttributeStorageStrategyType.INDEX_ONLY); if (schemaHandlingAttrDefType.getMatchingRule() != null) { rAttrDef.matchingRuleQName = schemaHandlingAttrDefType.getMatchingRule(); } diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd index 6efc6b9f6d7..3405dced36e 100755 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd @@ -8160,7 +8160,7 @@ It can be queried. If needed to get it, explicit INCLUDE option has to be used. - + diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectRetriever.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectRetriever.java index bf3e924b64e..f5587b577af 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectRetriever.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/helpers/ObjectRetriever.java @@ -621,6 +621,7 @@ private PrismObject updateLoadedObject(GetObjectResult private void loadIndexOnlyItemsIfNeeded(PrismObject prismObject, Collection> options, boolean raw, Session session) throws SchemaException { List> retrieveOptions = SelectorOptions.filterRetrieveOptions(options); + LOGGER.trace("loadIndexOnlyItemsIfNeeded: retrieval options = {}", retrieveOptions); if (retrieveOptions.isEmpty()) { return; } @@ -661,8 +662,11 @@ private void loadIndexOnlyItemsIfNeeded(PrismObject pr // todo what about extension items that are not part of object extension definition? // attributes - if (ShadowType.class.equals(prismObject.getCompileTimeClass())) { + Class compileTimeClass = prismObject.getCompileTimeClass(); + LOGGER.trace("Object class: {}", compileTimeClass); + if (ShadowType.class.equals(compileTimeClass)) { boolean getAllAttributes = SelectorOptions.hasToLoadPath(ShadowType.F_ATTRIBUTES, retrieveOptions, false); + LOGGER.trace("getAllAttributes = {}", getAllAttributes); if (getAllAttributes) { if (rObject == null) { rObject = session.load(RShadow.class, prismObject.getOid()); @@ -687,6 +691,7 @@ private void retrieveAllAttributeValues(PrismObject shadowObject, PrismContainer attributeContainer = shadowObject.findOrCreateContainer(ShadowType.F_ATTRIBUTES); // Hack: let's ignore values of attributes that already exist in this container Collection existingAttributeNames = attributeContainer.getValue().getItemNames(); + LOGGER.trace("existingAttributeNames = {}", existingAttributeNames); for (ROExtValue rValue : dbCollection) { if (rValue.getOwnerType() == RObjectExtensionType.ATTRIBUTES) { LOGGER.trace("- processing {}", rValue);