diff --git a/build-system/pom.xml b/build-system/pom.xml
index 6e8edfbb3d7..c16f6dfcf6b 100644
--- a/build-system/pom.xml
+++ b/build-system/pom.xml
@@ -80,7 +80,7 @@
5.19.0.2
1.3
2.0.6
- 1.4.2.16
+ 1.4.3.0-SNAPSHOT
6.1.1
10.11.1.1
1.8.0
@@ -603,7 +603,7 @@
com.evolveum.polygon
connector-ldap
- 1.4.2.18
+ 1.4.3.0-SNAPSHOT
xml-apis
diff --git a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConfiguration.java b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConfiguration.java
index bac0841a44b..ceaf98de250 100644
--- a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConfiguration.java
+++ b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConfiguration.java
@@ -59,6 +59,7 @@ public class DummyConfiguration extends AbstractConfiguration {
private Integer minPasswordLength = null;
private boolean addConnectorStateAttributes = false;
private boolean supportReturnDefaultAttributes = false; // used e.g. for livesync vs. auxiliary object classes test
+ private boolean requireNameHint = false;
/**
* Defines name of the dummy resource instance. There may be several dummy resource running in
@@ -345,6 +346,15 @@ public void setSupportReturnDefaultAttributes(boolean supportReturnDefaultAttrib
this.supportReturnDefaultAttributes = supportReturnDefaultAttributes;
}
+ @ConfigurationProperty
+ public boolean isRequireNameHint() {
+ return requireNameHint;
+ }
+
+ public void setRequireNameHint(boolean requireNameHint) {
+ this.requireNameHint = requireNameHint;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java
index 3c187817fc1..4f1e211758f 100644
--- a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java
+++ b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java
@@ -49,6 +49,7 @@
import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
import org.identityconnectors.framework.common.objects.filter.Filter;
import org.identityconnectors.framework.common.objects.filter.FilterTranslator;
+import org.identityconnectors.framework.common.objects.filter.FilterVisitor;
import org.identityconnectors.framework.common.objects.filter.GreaterThanFilter;
import org.identityconnectors.framework.common.objects.filter.GreaterThanOrEqualFilter;
import org.identityconnectors.framework.common.objects.filter.LessThanFilter;
@@ -289,6 +290,7 @@ public Uid create(final ObjectClass objectClass, final Set createAttr
public Uid update(ObjectClass objectClass, Uid uid, Set replaceAttributes, OperationOptions options) {
log.info("update::begin");
validate(objectClass);
+ validate(uid);
try {
@@ -514,6 +516,7 @@ public Uid update(ObjectClass objectClass, Uid uid, Set replaceAttrib
*/
public Uid addAttributeValues(ObjectClass objectClass, Uid uid, Set valuesToAdd, OperationOptions options) {
validate(objectClass);
+ validate(uid);
try {
@@ -705,6 +708,7 @@ public Uid addAttributeValues(ObjectClass objectClass, Uid uid, Set v
*/
public Uid removeAttributeValues(ObjectClass objectClass, Uid uid, Set valuesToRemove, OperationOptions options) {
validate(objectClass);
+ validate(uid);
try {
@@ -881,10 +885,12 @@ public Uid removeAttributeValues(ObjectClass objectClass, Uid uid, Set createFilterTranslator(ObjectClass objectClass,
public void executeQuery(ObjectClass objectClass, Filter query, ResultsHandler handler, OperationOptions options) {
log.info("executeQuery({0},{1},{2},{3})", objectClass, query, handler, options);
validate(objectClass);
+ validate(query);
notNull(handler, "Results handled object can't be null.");
Collection attributesToGet = getAttrsToGet(options);
@@ -1442,7 +1449,11 @@ public void sync(ObjectClass objectClass, SyncToken token, SyncResultsHandler ha
if (configuration.getUidMode().equals(DummyConfiguration.UID_MODE_NAME)) {
uid = new Uid(delta.getObjectName());
} else if (configuration.getUidMode().equals(DummyConfiguration.UID_MODE_UUID)) {
- uid = new Uid(delta.getObjectId());
+ if (nameHintChecksEnabled()) {
+ uid = new Uid(delta.getObjectId(), new Name(delta.getObjectName()));
+ } else {
+ uid = new Uid(delta.getObjectId());
+ }
} else {
throw new IllegalStateException("Unknown UID mode "+configuration.getUidMode());
}
@@ -1898,4 +1909,113 @@ private boolean attributesToGetHasAttribute(Collection attributesToGet,
return attributesToGet.contains(attrName);
}
+ public void validate(ObjectClass oc) {
+ if (oc == null) {
+ throw new IllegalArgumentException("Object class must not be null.");
+ }
+ }
+
+ public void validate(Uid uid) {
+ if (uid == null) {
+ throw new IllegalArgumentException("Uid must not be null.");
+ }
+ if (nameHintChecksEnabled()) {
+ if (uid.getNameHint() == null) {
+ throw new IllegalArgumentException("Uid name hint must not be null.");
+ }
+ if (StringUtils.isBlank(uid.getNameHintValue())) {
+ throw new IllegalArgumentException("Uid name hint must not be empty.");
+ }
+ }
+ }
+
+ private void validate(Filter filter) {
+ if (filter == null) {
+ return;
+ }
+ if (nameHintChecksEnabled()) {
+ filter.accept(new FilterVisitor() {
+
+ @Override
+ public String visitAndFilter(String p, AndFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitContainsFilter(String p, ContainsFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitContainsAllValuesFilter(String p, ContainsAllValuesFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitEqualsFilter(String p, EqualsFilter filter) {
+ if (filter.getAttribute().is(Uid.NAME)) {
+ Uid uid = (Uid)filter.getAttribute();
+ if (uid.getNameHint() == null) {
+ throw new IllegalArgumentException("Uid name hint must not be null in filter "+filter);
+ }
+ if (StringUtils.isBlank(uid.getNameHintValue())) {
+ throw new IllegalArgumentException("Uid name hint must not be empty in filter "+filter);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String visitExtendedFilter(String p, Filter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitGreaterThanFilter(String p, GreaterThanFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitGreaterThanOrEqualFilter(String p, GreaterThanOrEqualFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitLessThanFilter(String p, LessThanFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitLessThanOrEqualFilter(String p, LessThanOrEqualFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitNotFilter(String p, NotFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitOrFilter(String p, OrFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitStartsWithFilter(String p, StartsWithFilter filter) {
+ return null;
+ }
+
+ @Override
+ public String visitEndsWithFilter(String p, EndsWithFilter filter) {
+ return null;
+ }
+
+ }, null);
+ }
+ }
+
+ private boolean nameHintChecksEnabled() {
+ return configuration.isRequireNameHint() && !resource.isDisableNameHintChecks();
+ }
+
}
diff --git a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/Utils.java b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/Utils.java
index 4dbbaed6a5e..ea75f83075e 100644
--- a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/Utils.java
+++ b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2013 Evolveum
+ * Copyright (c) 2010-201ΕΎ Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,12 +58,6 @@ public static T getAttributeSingleValue(Set attributes, String at
return null;
}
- public static void validate(ObjectClass oc) {
- if (oc == null) {
- throw new IllegalArgumentException("Object class must not be null.");
- }
- }
-
public static void notNull(Object object, String message) {
if (object == null) {
throw new IllegalArgumentException(message);
diff --git a/icf-connectors/dummy-resource/src/main/java/com/evolveum/icf/dummy/resource/DummyResource.java b/icf-connectors/dummy-resource/src/main/java/com/evolveum/icf/dummy/resource/DummyResource.java
index ade8ba64937..7907d7e0b13 100644
--- a/icf-connectors/dummy-resource/src/main/java/com/evolveum/icf/dummy/resource/DummyResource.java
+++ b/icf-connectors/dummy-resource/src/main/java/com/evolveum/icf/dummy/resource/DummyResource.java
@@ -110,6 +110,8 @@ public class DummyResource implements DebugDumpable {
private boolean generateAccountDescriptionOnCreate = false; // simulates volatile behavior (on create)
private boolean generateAccountDescriptionOnUpdate = false; // simulates volatile behavior (on update)
+
+ private boolean disableNameHintChecks = false;
// Following two properties are just copied from the connector
// configuration and can be checked later. They are otherwise
@@ -315,6 +317,14 @@ public void setGenerateAccountDescriptionOnUpdate(boolean generateAccountDescrip
this.generateAccountDescriptionOnUpdate = generateAccountDescriptionOnUpdate;
}
+ public boolean isDisableNameHintChecks() {
+ return disableNameHintChecks;
+ }
+
+ public void setDisableNameHintChecks(boolean disableNameHintChecks) {
+ this.disableNameHintChecks = disableNameHintChecks;
+ }
+
public Collection getForbiddenNames() {
return forbiddenNames;
}
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java
index b99b7bfa89f..3ed20b7406c 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java
@@ -460,13 +460,6 @@ public void collectEntitlementsAsObjectOperationDelete(ProvisioningContext s
ObjectQuery query = createQuery(assocDefType, assocAttrDef, valueAttr);
- // ObjectFilter filter = EqualsFilter.createEqual(new ItemPath(ShadowType.F_ATTRIBUTES), assocAttrDef, valueAttr.getValue());
- // ObjectFilter filter = InFilter.createIn(new ItemPath(ShadowType.F_ATTRIBUTES, assocAttrDef.getName()), assocAttrDef, valueAttr.getValue());
- // ObjectFilter filter = EqualsFilter.createEqual(new ItemPath(ShadowType.F_ATTRIBUTES, assocAttrDef.getName()), assocAttrDef, valueAttr.getValue());
- // ObjectQuery query = ObjectQuery.createObjectQuery(filter);
- // new ObjectQuery();
- // query.setFilter(filter);
-
AttributesToReturn attributesToReturn = ProvisioningUtil.createAttributesToReturn(entitlementCtx);
SearchHierarchyConstraints searchHierarchyConstraints = null;
@@ -482,13 +475,15 @@ public void collectEntitlementsAsObjectOperationDelete(ProvisioningContext s
ResultHandler handler = new ResultHandler() {
@Override
public boolean handle(PrismObject entitlementShadow) {
- Collection extends ResourceAttribute>> identifiers = ShadowUtil.getPrimaryIdentifiers(entitlementShadow);
- ResourceObjectDiscriminator disc = new ResourceObjectDiscriminator(entitlementOcDef.getTypeName(), identifiers);
+ Collection extends ResourceAttribute>> primaryIdentifiers = ShadowUtil.getPrimaryIdentifiers(entitlementShadow);
+ ResourceObjectDiscriminator disc = new ResourceObjectDiscriminator(entitlementOcDef.getTypeName(), primaryIdentifiers);
ResourceObjectOperations operations = roMap.get(disc);
if (operations == null) {
operations = new ResourceObjectOperations();
roMap.put(disc, operations);
operations.setResourceObjectContext(entitlementCtx);
+ Collection extends ResourceAttribute>> allIdentifiers = ShadowUtil.getAllIdentifiers(entitlementShadow);
+ operations.setAllIdentifiers(allIdentifiers);
}
PropertyDelta attributeDelta = null;
@@ -706,7 +701,7 @@ private PrismObject collectEntitlementAsObjectOperation(Prov
ResourceAttribute valueAttr = ShadowUtil.getAttribute(subjectShadow, valueAttrName);
if (valueAttr == null) {
if (!ShadowUtil.isFullShadow(subjectShadow)) {
- Collection> subjectIdentifiers = ShadowUtil.getPrimaryIdentifiers(subjectShadow);
+ Collection> subjectIdentifiers = ShadowUtil.getAllIdentifiers(subjectShadow);
LOGGER.trace("Fetching {} ({})", subjectShadow, subjectIdentifiers);
subjectShadow = resourceObjectReferenceResolver.fetchResourceObject(subjectCtx, subjectIdentifiers, null, result);
subjectShadowAfter = subjectShadow;
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java
index 2d6502f29ba..9d3829ce04c 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ProvisioningServiceImpl.java
@@ -421,9 +421,8 @@ public int synchronize(ResourceShadowDiscriminator shadowCoordinates, Task task,
SchemaDebugUtil.prettyPrint(tokenProperty));
}
- LOGGER.trace("Calling shadow cache to synchronize");
processedChanges = getShadowCache(Mode.STANDARD).synchronize(shadowCoordinates, tokenProperty, task, result);
- LOGGER.trace("shadow cache to synchronized {} entries", processedChanges);
+ LOGGER.debug("Synchronization of {} done, token {}, {} changes", resource, tokenProperty, processedChanges);
} catch (ObjectNotFoundException e) {
ProvisioningUtil.recordFatalError(LOGGER, result, "Synchronization error: object not found: " + e.getMessage(), e);
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectConverter.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectConverter.java
index 9e92ce0b1cb..aa89ce1656b 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectConverter.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectConverter.java
@@ -319,7 +319,7 @@ public void deleteResourceObject(ProvisioningContext ctx, PrismObject> identifiers = ShadowUtil
- .getPrimaryIdentifiers(shadow);
+ .getAllIdentifiers(shadow);
if (ProvisioningUtil.isProtectedShadow(ctx.getObjectClassDefinition(), shadow, matchingRuleRegistry)) {
LOGGER.error("Attempt to delete protected resource object " + ctx.getObjectClassDefinition() + ": "
@@ -392,7 +392,7 @@ public Collection> modifyResourceObject(
RefinedObjectClassDefinition objectClassDefinition = ctx.getObjectClassDefinition();
Collection operations = new ArrayList();
- Collection extends ResourceAttribute>> identifiers = ShadowUtil.getPrimaryIdentifiers(repoShadow);
+ Collection extends ResourceAttribute>> identifiers = ShadowUtil.getAllIdentifiers(repoShadow);
if (ProvisioningUtil.isProtectedShadow(ctx.getObjectClassDefinition(), repoShadow, matchingRuleRegistry)) {
@@ -1016,17 +1016,22 @@ private void executeEntitlements(ProvisioningContext subjectCtx,
for (Entry entry: roMap.entrySet()) {
ResourceObjectDiscriminator disc = entry.getKey();
ProvisioningContext entitlementCtx = entry.getValue().getResourceObjectContext();
- Collection extends ResourceAttribute>> identifiers = disc.getIdentifiers();
- Collection operations = entry.getValue().getOperations();
+ Collection extends ResourceAttribute>> primaryIdentifiers = disc.getPrimaryIdentifiers();
+ ResourceObjectOperations resourceObjectOperations = entry.getValue();
+ Collection extends ResourceAttribute>> allIdentifiers = resourceObjectOperations.getAllIdentifiers();
+ if (allIdentifiers == null || allIdentifiers.isEmpty()) {
+ allIdentifiers = primaryIdentifiers;
+ }
+ Collection operations = resourceObjectOperations.getOperations();
if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Excuting entitlement change identifiers={}:", identifiers, DebugUtil.debugDump(operations, 1));
+ LOGGER.trace("Excuting entitlement change identifiers={}:", allIdentifiers, DebugUtil.debugDump(operations, 1));
}
OperationResult result = parentResult.createMinorSubresult(OPERATION_MODIFY_ENTITLEMENT);
try {
- executeModify(entitlementCtx, entry.getValue().getCurrentShadow(), identifiers, operations, result);
+ executeModify(entitlementCtx, entry.getValue().getCurrentShadow(), allIdentifiers, operations, result);
result.recordSuccess();
@@ -1040,6 +1045,10 @@ private void executeEntitlements(ProvisioningContext subjectCtx,
// properly record the operation in the result.
LOGGER.error("Error while modifying entitlement {} of {}: {}", entitlementCtx, subjectCtx, e.getMessage(), e);
result.recordFatalError(e);
+ } catch (RuntimeException | Error e) {
+ LOGGER.error("Error while modifying entitlement {} of {}: {}", entitlementCtx, subjectCtx, e.getMessage(), e);
+ result.recordFatalError(e);
+ throw e;
}
}
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectDiscriminator.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectDiscriminator.java
index dd18a82e587..79a0ed3a01e 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectDiscriminator.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectDiscriminator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Evolveum
+ * Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,20 +33,20 @@
public class ResourceObjectDiscriminator {
private QName objectClass;
- private Collection extends ResourceAttribute>> identifiers;
+ private Collection extends ResourceAttribute>> primaryIdentifiers;
- public ResourceObjectDiscriminator(QName objectClass, Collection extends ResourceAttribute>> identifiers) {
+ public ResourceObjectDiscriminator(QName objectClass, Collection extends ResourceAttribute>> primaryIdentifiers) {
super();
this.objectClass = objectClass;
- this.identifiers = identifiers;
+ this.primaryIdentifiers = primaryIdentifiers;
}
public QName getObjectClass() {
return objectClass;
}
- public Collection extends ResourceAttribute>> getIdentifiers() {
- return identifiers;
+ public Collection extends ResourceAttribute>> getPrimaryIdentifiers() {
+ return primaryIdentifiers;
}
public boolean matches(PrismObject shadow) {
@@ -55,14 +55,14 @@ public boolean matches(PrismObject shadow) {
return false;
}
Collection> shadowIdentifiers = ShadowUtil.getPrimaryIdentifiers(shadow);
- return PrismProperty.compareCollectionRealValues(identifiers, shadowIdentifiers);
+ return PrismProperty.compareCollectionRealValues(primaryIdentifiers, shadowIdentifiers);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((identifiers == null) ? 0 : identifiers.hashCode());
+ result = prime * result + ((primaryIdentifiers == null) ? 0 : primaryIdentifiers.hashCode());
result = prime * result + ((objectClass == null) ? 0 : objectClass.hashCode());
return result;
}
@@ -76,10 +76,10 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
ResourceObjectDiscriminator other = (ResourceObjectDiscriminator) obj;
- if (identifiers == null) {
- if (other.identifiers != null)
+ if (primaryIdentifiers == null) {
+ if (other.primaryIdentifiers != null)
return false;
- } else if (!identifiers.equals(other.identifiers))
+ } else if (!primaryIdentifiers.equals(other.primaryIdentifiers))
return false;
if (objectClass == null) {
if (other.objectClass != null)
@@ -91,7 +91,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return "ResourceObjectDiscriminator(" + objectClass + ": " + identifiers + ")";
+ return "ResourceObjectDiscriminator(" + objectClass + ": " + primaryIdentifiers + ")";
}
}
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectOperations.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectOperations.java
index 846fba232a6..a121feca3ed 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectOperations.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ResourceObjectOperations.java
@@ -35,6 +35,7 @@ public class ResourceObjectOperations {
private Collection operations = new ArrayList<>();
private PrismObject currentShadow = null;
private ProvisioningContext resourceObjectContext = null;
+ private Collection extends ResourceAttribute>> allIdentifiers;
public PrismObject getCurrentShadow() {
return currentShadow;
@@ -56,6 +57,14 @@ public Collection getOperations() {
return operations;
}
+ public Collection extends ResourceAttribute>> getAllIdentifiers() {
+ return allIdentifiers;
+ }
+
+ public void setAllIdentifiers(Collection extends ResourceAttribute>> allIdentifiers) {
+ this.allIdentifiers = allIdentifiers;
+ }
+
@Override
public String toString() {
return "ResourceObjectOperations(operations=" + operations + ", currentShadow=" + currentShadow
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java
index a6e29b59710..903947a00e8 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java
@@ -255,7 +255,7 @@ public PrismObject getShadow(String oid, PrismObject rep
// Let's get all the identifiers from the Shadow part
Collection extends ResourceAttribute>> identifiers = ShadowUtil
- .getPrimaryIdentifiers(repositoryShadow);
+ .getAllIdentifiers(repositoryShadow);
if (identifiers == null || identifiers.isEmpty()) {
// check if the account is not only partially created (exist
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java
index acac88eda66..5afb9ad818c 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java
@@ -210,7 +210,7 @@ public PrismObject lookupShadowInRepository(ProvisioningContext ctx,
OperationResult parentResult)
throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException {
- ObjectQuery query = createSearchShadowQuery(ctx, identifierContainer.getValue().getItems(), prismContext,
+ ObjectQuery query = createSearchShadowQuery(ctx, identifierContainer.getValue().getItems(), false, prismContext,
parentResult);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Searching for shadow using filter (repo):\n{}",
@@ -578,23 +578,24 @@ private PrismObject createNewAccountFromChange(ProvisioningContext c
private List> searchShadowByIdenifiers(ProvisioningContext ctx, Change change, OperationResult parentResult)
throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException {
- ObjectQuery query = createSearchShadowQuery(ctx, change.getIdentifiers(), prismContext, parentResult);
+ Collection> identifiers = change.getIdentifiers();
+ ObjectQuery query = createSearchShadowQuery(ctx, identifiers, true, prismContext, parentResult);
List> accountList = null;
try {
accountList = repositoryService.searchObjects(ShadowType.class, query, null, parentResult);
} catch (SchemaException ex) {
parentResult.recordFatalError(
- "Failed to search shadow according to the identifiers: " + change.getIdentifiers() + ". Reason: "
+ "Failed to search shadow according to the identifiers: " + identifiers + ". Reason: "
+ ex.getMessage(), ex);
throw new SchemaException("Failed to search shadow according to the identifiers: "
- + change.getIdentifiers() + ". Reason: " + ex.getMessage(), ex);
+ + identifiers + ". Reason: " + ex.getMessage(), ex);
}
MiscSchemaUtil.reduceSearchResult(accountList);
return accountList;
}
- private ObjectQuery createSearchShadowQuery(ProvisioningContext ctx, Collection> identifiers,
+ private ObjectQuery createSearchShadowQuery(ProvisioningContext ctx, Collection> identifiers, boolean primaryIdentifiersOnly,
PrismContext prismContext, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException {
List conditions = new ArrayList();
RefinedObjectClassDefinition objectClassDefinition = ctx.getObjectClassDefinition();
@@ -607,9 +608,16 @@ private ObjectQuery createSearchShadowQuery(ProvisioningContext ctx, Collection<
// definition from any of them.
RefinedObjectClassDefinition anyDefinition = ctx.getRefinedSchema().getRefinedDefinitions().iterator().next();
rAttrDef = anyDefinition.findAttributeDefinition(identifier.getElementName());
+ if (primaryIdentifiersOnly && !anyDefinition.isPrimaryIdentifier(identifier.getElementName())) {
+ continue;
+ }
} else {
+ if (primaryIdentifiersOnly && !objectClassDefinition.isPrimaryIdentifier(identifier.getElementName())) {
+ continue;
+ }
rAttrDef = objectClassDefinition.findAttributeDefinition(identifier.getElementName());
}
+
String normalizedIdentifierValue = (String) getNormalizedAttributeValue(identifierValue, rAttrDef);
//new ItemPath(ShadowType.F_ATTRIBUTES)
PrismPropertyDefinition def = (PrismPropertyDefinition) identifier.getDefinition();
diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java
index 7e6209aa437..106699170f5 100644
--- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java
+++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java
@@ -210,7 +210,7 @@ public class ConnectorInstanceIcfImpl implements ConnectorInstance {
ConnectorInfo cinfo;
ConnectorType connectorType;
- ConnectorFacade icfConnectorFacade;
+ ConnectorFacade connIdConnectorFacade;
String resourceSchemaNamespace;
private APIConfiguration apiConfig = null;
@@ -303,7 +303,7 @@ public void configure(PrismContainerValue> configuration, OperationResult pare
}
// Create new connector instance using the transformed configuration
- icfConnectorFacade = ConnectorFacadeFactory.getInstance().newInstance(apiConfig);
+ connIdConnectorFacade = ConnectorFacadeFactory.getInstance().newInstance(apiConfig);
result.recordSuccess();
} catch (Throwable ex) {
@@ -548,7 +548,7 @@ public void initialize(ResourceSchema resourceSchema, Collection