You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/10 05:35:32 UTC
[06/11] syncope git commit: Unique schema key across the three tables
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/domains/TwoContent.xml b/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
index a24431e..3d8d0a5 100644
--- a/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/TwoContent.xml
@@ -22,6 +22,7 @@ under the License.
<SyncopeConf id="cd64d66f-6fff-4008-b966-a06b1cc1436d"/>
+ <SyncopeSchema id="password.cipher.algorithm"/>
<PlainSchema id="password.cipher.algorithm" type="String"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="56db89b9-119e-4923-a16e-f42823b90c66"
@@ -29,6 +30,7 @@ under the License.
<CPlainAttrValue id="870323e8-8db6-4a64-b512-15f9fa094905"
attribute_id="56db89b9-119e-4923-a16e-f42823b90c66" stringValue="SHA1"/>
+ <SyncopeSchema id="token.length"/>
<PlainSchema id="token.length" type="Long"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="58977caa-dcf7-4ae3-8591-7e3d0a395200"
@@ -36,6 +38,7 @@ under the License.
<CPlainAttrValue id="372e28e0-3af1-4774-b668-81aa84903b75"
attribute_id="58977caa-dcf7-4ae3-8591-7e3d0a395200" longValue="256"/>
+ <SyncopeSchema id="token.expireTime"/>
<PlainSchema id="token.expireTime" type="Long"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="01f69abd-df85-4e1b-bb88-ad570594e045"
@@ -43,6 +46,7 @@ under the License.
<CPlainAttrValue id="963970cf-4af6-46bb-875b-a1b758ac8d05"
attribute_id="01f69abd-df85-4e1b-bb88-ad570594e045" longValue="60"/>
+ <SyncopeSchema id="selfRegistration.allowed"/>
<PlainSchema id="selfRegistration.allowed" type="Boolean"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="7b19cefa-d606-477c-8431-c9464f53fe8b"
@@ -50,6 +54,7 @@ under the License.
<CPlainAttrValue id="c8b9a0f1-0168-4e2a-95b8-4819fc70e620"
attribute_id="7b19cefa-d606-477c-8431-c9464f53fe8b" booleanValue="1"/>
+ <SyncopeSchema id="passwordReset.allowed"/>
<PlainSchema id="passwordReset.allowed" type="Boolean"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="dc35cc97-6ed9-4bb2-bb3b-509f4cd8f3d3"
@@ -57,6 +62,7 @@ under the License.
<CPlainAttrValue id="b1ecea41-ab7c-4dd3-9e3e-b6baf0f98046"
attribute_id="dc35cc97-6ed9-4bb2-bb3b-509f4cd8f3d3" booleanValue="1"/>
+ <SyncopeSchema id="passwordReset.securityQuestion"/>
<PlainSchema id="passwordReset.securityQuestion" type="Boolean"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="e5a712ad-53fd-4102-ba55-fb45caed5f7b"
@@ -64,6 +70,7 @@ under the License.
<CPlainAttrValue id="b5e8e79d-8039-4318-9698-fe5e181ebe98"
attribute_id="e5a712ad-53fd-4102-ba55-fb45caed5f7b" booleanValue="1"/>
+ <SyncopeSchema id="authentication.statuses"/>
<PlainSchema id="authentication.statuses" type="String" multivalue="1" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="888ae8e1-a295-4ee2-a15e-31dbf6dfc3f9"
owner_id="cd64d66f-6fff-4008-b966-a06b1cc1436d" schema_id="authentication.statuses"/>
@@ -73,6 +80,7 @@ under the License.
attribute_id="888ae8e1-a295-4ee2-a15e-31dbf6dfc3f9" stringValue="active"/>
<!-- Save user login date upon successful authentication -->
+ <SyncopeSchema id="log.lastlogindate"/>
<PlainSchema id="log.lastlogindate" type="Boolean"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="9891c0a7-27ee-4215-9eea-ca32e580b4e4"
@@ -80,6 +88,7 @@ under the License.
<CPlainAttrValue id="162dd874-0417-4bb9-9724-db1ff2952dd1"
attribute_id="9891c0a7-27ee-4215-9eea-ca32e580b4e4" booleanValue="1"/>
+ <SyncopeSchema id="tasks.interruptMaxRetries"/>
<PlainSchema id="tasks.interruptMaxRetries" type="Long"
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="c2b9ca96-c6ef-433d-8287-0e0cfd0ad0db"
@@ -88,6 +97,7 @@ under the License.
attribute_id="c2b9ca96-c6ef-433d-8287-0e0cfd0ad0db" longValue="20"/>
<!-- Return hashed password values when reading users -->
+ <SyncopeSchema id="return.password.value"/>
<PlainSchema id="return.password.value" type="Boolean"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CPlainAttr id="bcfd7efc-0605-4b5e-b4bb-85c1d5f6493a"
@@ -101,6 +111,7 @@ under the License.
<AnyType id="GROUP" kind="GROUP"/>
+ <SyncopeSchema id="email"/>
<PlainSchema id="email" type="String" anyTypeClass_id="BaseUser"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
validatorClass="org.apache.syncope.core.persistence.jpa.attrvalue.validation.EmailAddressValidator"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrNameParser.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrNameParser.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrNameParser.java
new file mode 100644
index 0000000..4beb5ce
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrNameParser.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.provisioning.api;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
+
+public final class IntAttrNameParser {
+
+ private static final Pattern ENCLOSING_GROUP_PATTERN = Pattern.compile("^groups\\[[\\w]+\\]\\.[\\w]+");
+
+ private static final Pattern RELATED_ANY_OBJECT_PATTERN = Pattern.compile("^anyObjects\\[[\\w]+\\]\\.[\\w]+");
+
+ private static final Pattern MEMBERSHIP_PATTERN = Pattern.compile("^\\[[\\w]+\\]\\.[\\w]+");
+
+ public static class IntAttrName {
+
+ private AnyTypeKind anyTypeKind;
+
+ private String field;
+
+ private SchemaType schemaType;
+
+ private String schemaName;
+
+ private String enclosingGroup;
+
+ private String relatedAnyObject;
+
+ private String membershipOfGroup;
+
+ public AnyTypeKind getAnyTypeKind() {
+ return anyTypeKind;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public SchemaType getSchemaType() {
+ return schemaType;
+ }
+
+ public String getSchemaName() {
+ return schemaName;
+ }
+
+ public String getEnclosingGroup() {
+ return enclosingGroup;
+ }
+
+ public String getRelatedAnyObject() {
+ return relatedAnyObject;
+ }
+
+ public String getMembershipOfGroup() {
+ return membershipOfGroup;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(field, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ }
+
+ private static void setFieldOrSchemaName(
+ final String fieldOrSchemaName, final AnyUtils anyUtils, final IntAttrName result) {
+
+ if (anyUtils.isFieldName(fieldOrSchemaName)) {
+ result.field = fieldOrSchemaName;
+ } else {
+ result.schemaName = fieldOrSchemaName;
+ }
+ }
+
+ public static IntAttrName parse(
+ final String intAttrName,
+ final AnyUtilsFactory anyUtilsFactory,
+ final AnyTypeKind provisionAnyTypeKind) {
+
+ IntAttrName result = new IntAttrName();
+
+ if (intAttrName.indexOf('.') == -1) {
+ result.anyTypeKind = provisionAnyTypeKind;
+ setFieldOrSchemaName(intAttrName, anyUtilsFactory.getInstance(provisionAnyTypeKind), result);
+ } else {
+ Matcher matcher = ENCLOSING_GROUP_PATTERN.matcher(intAttrName);
+ if (matcher.matches()) {
+ result.anyTypeKind = AnyTypeKind.GROUP;
+ result.enclosingGroup = matcher.group(1);
+ setFieldOrSchemaName(matcher.group(2), anyUtilsFactory.getInstance(AnyTypeKind.GROUP), result);
+ } else {
+ matcher = RELATED_ANY_OBJECT_PATTERN.matcher(intAttrName);
+ if (matcher.matches()) {
+ result.anyTypeKind = AnyTypeKind.ANY_OBJECT;
+ result.relatedAnyObject = matcher.group(1);
+ setFieldOrSchemaName(matcher.group(2), anyUtilsFactory.getInstance(AnyTypeKind.ANY_OBJECT), result);
+ } else {
+ matcher = MEMBERSHIP_PATTERN.matcher(intAttrName);
+ if (matcher.matches()) {
+ result.anyTypeKind = AnyTypeKind.USER;
+ result.membershipOfGroup = matcher.group(1);
+ setFieldOrSchemaName(matcher.group(2), anyUtilsFactory.getInstance(AnyTypeKind.USER), result);
+ } else {
+ throw new IllegalArgumentException("Unparsable expression: " + intAttrName);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private IntAttrNameParser() {
+ // private constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/MappingManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/MappingManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/MappingManager.java
index 4600f9a..99c1ba8 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/MappingManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/MappingManager.java
@@ -44,11 +44,11 @@ public interface MappingManager {
* Get attribute values for the given {@link MappingItem} and any objects.
*
* @param provision provision information
- * @param mappingItem mapping item
+ * @param mapItem mapping item
* @param anys any objects
* @return attribute values.
*/
- List<PlainAttrValue> getIntValues(Provision provision, MappingItem mappingItem, List<Any<?>> anys);
+ List<PlainAttrValue> getIntValues(Provision provision, MappingItem mapItem, List<Any<?>> anys);
/**
* Prepare attributes for sending to a connector instance.
@@ -68,11 +68,11 @@ public interface MappingManager {
* connector.
*
* @param <T> any object
- * @param mappingItem mapping item
+ * @param mapItem mapping item
* @param attr attribute received from connector
* @param anyTO any object
* @param anyUtils any utils
*/
- <T extends AnyTO> void setIntValues(MappingItem mappingItem, Attribute attr, T anyTO, AnyUtils anyUtils);
+ <T extends AnyTO> void setIntValues(MappingItem mapItem, Attribute attr, T anyTO, AnyUtils anyUtils);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
index b84799a..e2f793a 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java
@@ -38,7 +38,6 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.core.provisioning.api.utils.policy.InvalidPasswordRuleConf;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -74,6 +73,8 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
import org.apache.syncope.core.persistence.api.entity.resource.Provision;
import org.apache.syncope.core.provisioning.api.DerAttrHandler;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser.IntAttrName;
import org.apache.syncope.core.provisioning.api.MappingManager;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
@@ -349,7 +350,7 @@ public class MappingManagerImpl implements MappingManager {
String connObjectKey = null;
for (MappingItem mappingItem : getMappingItems(provision, MappingPurpose.PROPAGATION)) {
- LOG.debug("Processing schema {}", mappingItem.getIntAttrName());
+ LOG.debug("Processing expression '{}'", mappingItem.getIntAttrName());
try {
Pair<String, Attribute> preparedAttr = prepareAttr(provision, mappingItem, any, password);
@@ -373,7 +374,7 @@ public class MappingManagerImpl implements MappingManager {
}
}
} catch (Exception e) {
- LOG.debug("Attribute '{}' processing failed", mappingItem.getIntAttrName(), e);
+ LOG.debug("Expression '{}' processing failed", mappingItem.getIntAttrName(), e);
}
}
@@ -410,9 +411,12 @@ public class MappingManagerImpl implements MappingManager {
private Pair<String, Attribute> prepareAttr(
final Provision provision, final MappingItem mapItem, final Any<?> any, final String password) {
+ IntAttrName intAttrName =
+ IntAttrNameParser.parse(mapItem.getIntAttrName(), anyUtilsFactory, provision.getAnyType().getKind());
+
List<Any<?>> anys = new ArrayList<>();
- switch (mapItem.getIntMappingType().getAnyTypeKind()) {
+ switch (intAttrName.getAnyTypeKind()) {
case USER:
if (any instanceof User) {
anys.add(any);
@@ -443,18 +447,14 @@ public class MappingManagerImpl implements MappingManager {
AttrSchemaType schemaType;
Pair<String, Attribute> result;
- switch (mapItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- schema = plainSchemaDAO.find(mapItem.getIntAttrName());
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ schema = plainSchemaDAO.find(intAttrName.getSchemaName());
schemaType = schema == null ? AttrSchemaType.String : schema.getType();
break;
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- schema = virSchemaDAO.find(mapItem.getIntAttrName());
+ case VIRTUAL:
+ schema = virSchemaDAO.find(intAttrName.getSchemaName());
readOnlyVirSchema = (schema != null && schema.isReadonly());
schemaType = AttrSchemaType.String;
break;
@@ -470,10 +470,9 @@ public class MappingManagerImpl implements MappingManager {
LOG.debug("Define mapping for: "
+ "\n* ExtAttrName " + extAttrName
+ "\n* is connObjectKey " + mapItem.isConnObjectKey()
- + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
+ + "\n* is password " + mapItem.isPassword()
+ "\n* mandatory condition " + mapItem.getMandatoryCondition()
- + "\n* Schema " + mapItem.getIntAttrName()
- + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
+ + "\n* Schema " + intAttrName.getSchemaName()
+ "\n* ClassType " + schemaType.getType().getName()
+ "\n* Values " + values);
@@ -518,8 +517,7 @@ public class MappingManagerImpl implements MappingManager {
null, AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
}
} else if ((schema != null && schema.isMultivalue())
- || anyUtilsFactory.getInstance(any).getAnyTypeKind()
- != mapItem.getIntMappingType().getAnyTypeKind()) {
+ || anyUtilsFactory.getInstance(any).getAnyTypeKind() != intAttrName.getAnyTypeKind()) {
result = new ImmutablePair<>(
null, AttributeBuilder.build(extAttrName, objValues));
@@ -541,184 +539,150 @@ public class MappingManagerImpl implements MappingManager {
return evaluateNAME(any, provision, connObjectKey).getNameValue();
}
- /**
- * Get attribute values for the given {@link MappingItem} and any objects.
- *
- * @param provision provision information
- * @param mappingItem mapping item
- * @param anys any objects
- * @return attribute values.
- */
@Transactional(readOnly = true)
@Override
public List<PlainAttrValue> getIntValues(
- final Provision provision, final MappingItem mappingItem, final List<Any<?>> anys) {
+ final Provision provision, final MappingItem mapItem, final List<Any<?>> anys) {
- LOG.debug("Get attributes for '{}' and mapping type '{}'", anys, mappingItem.getIntMappingType());
+ LOG.debug("Get attributes for '{}' and intAttrName '{}'", anys, mapItem.getIntAttrName());
- boolean transform = true;
+ IntAttrName intAttrName =
+ IntAttrNameParser.parse(mapItem.getIntAttrName(), anyUtilsFactory, provision.getAnyType().getKind());
List<PlainAttrValue> values = new ArrayList<>();
- switch (mappingItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- for (Any<?> any : anys) {
- PlainAttr<?> attr = any.getPlainAttr(mappingItem.getIntAttrName());
- if (attr != null) {
- if (attr.getUniqueValue() != null) {
- PlainAttrUniqueValue value = SerializationUtils.clone(attr.getUniqueValue());
- value.setAttr(null);
- values.add(value);
- } else if (attr.getValues() != null) {
- for (PlainAttrValue value : attr.getValues()) {
- PlainAttrValue shadow = SerializationUtils.clone(value);
- shadow.setAttr(null);
- values.add(shadow);
- }
- }
- }
-
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
+ boolean transform = true;
- break;
+ if (intAttrName.getField() != null) {
+ switch (intAttrName.getField()) {
+ case "key":
+ for (Any<?> any : anys) {
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(any.getKey());
+ values.add(attrValue);
+ }
+ break;
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- DerSchema derSchema = derSchemaDAO.find(mappingItem.getIntAttrName());
- if (derSchema != null) {
+ case "username":
for (Any<?> any : anys) {
- String value = derAttrHandler.getValue(any, derSchema);
- if (value != null) {
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(value);
+ if (any instanceof User) {
+ UPlainAttrValue attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(((User) any).getUsername());
values.add(attrValue);
-
- LOG.debug("Retrieved values for {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- derSchema.getKey(), mappingItem.getIntAttrName(), mappingItem.getIntMappingType(),
- values);
}
}
- }
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- // virtual attributes don't get transformed
- transform = false;
+ break;
- VirSchema virSchema = virSchemaDAO.find(mappingItem.getIntAttrName());
- if (virSchema != null) {
+ case "name":
for (Any<?> any : anys) {
- LOG.debug("Expire entry cache {}-{}", any.getKey(), mappingItem.getIntAttrName());
- virAttrCache.expire(any.getType().getKey(), any.getKey(), mappingItem.getIntAttrName());
-
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- for (String value : virAttrHandler.getValues(any, virSchema)) {
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(value);
+ if (any instanceof Group) {
+ GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(((Group) any).getName());
+ values.add(attrValue);
+ } else if (any instanceof AnyObject) {
+ APlainAttrValue attrValue = entityFactory.newEntity(APlainAttrValue.class);
+ attrValue.setStringValue(((AnyObject) any).getName());
values.add(attrValue);
}
-
- LOG.debug("Retrieved values for {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- virSchema.getKey(), mappingItem.getIntAttrName(), mappingItem.getIntMappingType(),
- values);
}
- }
- break;
+ break;
- case UserKey:
- case GroupKey:
- case AnyObjectKey:
- for (Any<?> any : anys) {
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(any.getKey());
- values.add(attrValue);
- }
- break;
+ case "owner":
+ Mapping uMapping = provision.getAnyType().equals(anyTypeDAO.findUser())
+ ? provision.getMapping()
+ : null;
+ Mapping gMapping = provision.getAnyType().equals(anyTypeDAO.findGroup())
+ ? provision.getMapping()
+ : null;
- case Username:
- for (Any<?> any : anys) {
- if (any instanceof User) {
- UPlainAttrValue attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(((User) any).getUsername());
- values.add(attrValue);
- }
- }
- break;
+ for (Any<?> any : anys) {
+ if (any instanceof Group) {
+ Group group = (Group) any;
+ String groupOwnerValue = null;
+ if (group.getUserOwner() != null && uMapping != null) {
+ groupOwnerValue = getGroupOwnerValue(provision, group.getUserOwner());
+ }
+ if (group.getGroupOwner() != null && gMapping != null) {
+ groupOwnerValue = getGroupOwnerValue(provision, group.getGroupOwner());
+ }
- case GroupName:
- for (Any<?> any : anys) {
- if (any instanceof Group) {
- GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(((Group) any).getName());
- values.add(attrValue);
+ if (StringUtils.isNotBlank(groupOwnerValue)) {
+ GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(groupOwnerValue);
+ values.add(attrValue);
+ }
+ }
}
- }
- break;
+ break;
- case GroupOwnerSchema:
- Mapping uMapping = provision.getAnyType().equals(anyTypeDAO.findUser())
- ? provision.getMapping()
- : null;
- Mapping gMapping = provision.getAnyType().equals(anyTypeDAO.findGroup())
- ? provision.getMapping()
- : null;
-
- for (Any<?> any : anys) {
- if (any instanceof Group) {
- Group group = (Group) any;
- String groupOwnerValue = null;
- if (group.getUserOwner() != null && uMapping != null) {
- groupOwnerValue = getGroupOwnerValue(provision, group.getUserOwner());
- }
- if (group.getGroupOwner() != null && gMapping != null) {
- groupOwnerValue = getGroupOwnerValue(provision, group.getGroupOwner());
+ default:
+ }
+ } else if (intAttrName.getSchemaType() != null) {
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ for (Any<?> any : anys) {
+ PlainAttr<?> attr = any.getPlainAttr(intAttrName.getSchemaName());
+ if (attr != null) {
+ if (attr.getUniqueValue() != null) {
+ PlainAttrUniqueValue value = SerializationUtils.clone(attr.getUniqueValue());
+ value.setAttr(null);
+ values.add(value);
+ } else if (attr.getValues() != null) {
+ for (PlainAttrValue value : attr.getValues()) {
+ PlainAttrValue shadow = SerializationUtils.clone(value);
+ shadow.setAttr(null);
+ values.add(shadow);
+ }
+ }
}
-
- if (StringUtils.isNotBlank(groupOwnerValue)) {
- GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(groupOwnerValue);
- values.add(attrValue);
+ }
+ break;
+
+ case DERIVED:
+ DerSchema derSchema = derSchemaDAO.find(intAttrName.getSchemaName());
+ if (derSchema != null) {
+ for (Any<?> any : anys) {
+ String value = derAttrHandler.getValue(any, derSchema);
+ if (value != null) {
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
}
}
- }
- break;
+ break;
- case AnyObjectName:
- for (Any<?> any : anys) {
- if (any instanceof AnyObject) {
- APlainAttrValue attrValue = entityFactory.newEntity(APlainAttrValue.class);
- attrValue.setStringValue(((AnyObject) any).getName());
- values.add(attrValue);
+ case VIRTUAL:
+ // virtual attributes don't get transformed
+ transform = false;
+
+ VirSchema virSchema = virSchemaDAO.find(intAttrName.getSchemaName());
+ if (virSchema != null) {
+ for (Any<?> any : anys) {
+ LOG.debug("Expire entry cache {}-{}", any.getKey(), intAttrName.getSchemaName());
+ virAttrCache.expire(any.getType().getKey(), any.getKey(), intAttrName.getSchemaName());
+
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ for (String value : virAttrHandler.getValues(any, virSchema)) {
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+ }
}
- }
- break;
+ break;
- default:
+ default:
+ }
}
LOG.debug("Values for propagation: {}", values);
List<PlainAttrValue> transformed = values;
if (transform) {
- for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
- transformed = transformer.beforePropagation(mappingItem, anys, transformed);
+ for (MappingItemTransformer transformer : getMappingItemTransformers(mapItem)) {
+ transformed = transformer.beforePropagation(mapItem, anys, transformed);
}
LOG.debug("Transformed values for propagation: {}", values);
} else {
@@ -728,13 +692,6 @@ public class MappingManagerImpl implements MappingManager {
return transformed;
}
- /**
- * Get connObjectKey internal value.
- *
- * @param any any object
- * @param provision provision information
- * @return connObjectKey internal value
- */
@Transactional(readOnly = true)
@Override
public String getConnObjectKeyValue(final Any<?> any, final Provision provision) {
@@ -745,146 +702,134 @@ public class MappingManagerImpl implements MappingManager {
: values.get(0).getValueAsString();
}
- /**
- * Set attribute values, according to the given {@link MappingItem}, to any object from attribute received from
- * connector.
- *
- * @param mappingItem mapping item
- * @param attr attribute received from connector
- * @param anyTO any object
- * @param anyUtils any utils
- */
@Transactional(readOnly = true)
@Override
public void setIntValues(
- final MappingItem mappingItem, final Attribute attr, final AnyTO anyTO, final AnyUtils anyUtils) {
+ final MappingItem mapItem, final Attribute attr, final AnyTO anyTO, final AnyUtils anyUtils) {
List<Object> values = null;
if (attr != null) {
values = attr.getValue();
- for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
- values = transformer.beforePull(mappingItem, anyTO, values);
+ for (MappingItemTransformer transformer : getMappingItemTransformers(mapItem)) {
+ values = transformer.beforePull(mapItem, anyTO, values);
}
}
values = ListUtils.emptyIfNull(values);
- switch (mappingItem.getIntMappingType()) {
- case UserKey:
- case GroupKey:
- case AnyObjectKey:
- break;
-
- case Password:
- if (anyTO instanceof UserTO && !values.isEmpty()) {
- ((UserTO) anyTO).setPassword(ConnObjectUtils.getPassword(values.get(0)));
- }
- break;
-
- case Username:
- if (anyTO instanceof UserTO) {
- ((UserTO) anyTO).setUsername(values.isEmpty() || values.get(0) == null
- ? null
- : values.get(0).toString());
- }
- break;
+ IntAttrName intAttrName =
+ IntAttrNameParser.parse(mapItem.getIntAttrName(), anyUtilsFactory, anyUtils.getAnyTypeKind());
- case GroupName:
- if (anyTO instanceof GroupTO) {
- ((GroupTO) anyTO).setName(values.isEmpty() || values.get(0) == null
- ? null
- : values.get(0).toString());
- }
- break;
+ if (intAttrName.getField() != null) {
+ switch (intAttrName.getField()) {
+ case "key":
+ break;
- case GroupOwnerSchema:
- if (anyTO instanceof GroupTO && attr != null) {
- // using a special attribute (with schema "", that will be ignored) for carrying the
- // GroupOwnerSchema value
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(StringUtils.EMPTY);
- if (values.isEmpty() || values.get(0) == null) {
- attrTO.getValues().add(StringUtils.EMPTY);
- } else {
- attrTO.getValues().add(values.get(0).toString());
+ case "password":
+ if (anyTO instanceof UserTO && !values.isEmpty()) {
+ ((UserTO) anyTO).setPassword(ConnObjectUtils.getPassword(values.get(0)));
}
+ break;
- ((GroupTO) anyTO).getPlainAttrs().add(attrTO);
- }
- break;
+ case "username":
+ if (anyTO instanceof UserTO) {
+ ((UserTO) anyTO).setUsername(values.isEmpty() || values.get(0) == null
+ ? null
+ : values.get(0).toString());
+ }
+ break;
+
+ case "name":
+ if (anyTO instanceof GroupTO) {
+ ((GroupTO) anyTO).setName(values.isEmpty() || values.get(0) == null
+ ? null
+ : values.get(0).toString());
+ } else if (anyTO instanceof AnyObjectTO) {
+ ((AnyObjectTO) anyTO).setName(values.isEmpty() || values.get(0) == null
+ ? null
+ : values.get(0).toString());
+ }
+ break;
+
+ case "owner":
+ if (anyTO instanceof GroupTO && attr != null) {
+ // using a special attribute (with schema "", that will be ignored) for carrying the
+ // GroupOwnerSchema value
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(StringUtils.EMPTY);
+ if (values.isEmpty() || values.get(0) == null) {
+ attrTO.getValues().add(StringUtils.EMPTY);
+ } else {
+ attrTO.getValues().add(values.get(0).toString());
+ }
- case AnyObjectName:
- if (anyTO instanceof AnyObjectTO) {
- ((AnyObjectTO) anyTO).setName(values.isEmpty() || values.get(0) == null
- ? null
- : values.get(0).toString());
- }
- break;
+ ((GroupTO) anyTO).getPlainAttrs().add(attrTO);
+ }
+ break;
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
+ default:
+ }
+ } else if (intAttrName.getSchemaType() != null) {
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(intAttrName.getSchemaName());
- PlainSchema schema = plainSchemaDAO.find(mappingItem.getIntAttrName());
+ PlainSchema schema = plainSchemaDAO.find(intAttrName.getSchemaName());
- for (Object value : values) {
- AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
- if (value != null) {
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- switch (schemaType) {
- case String:
- attrValue.setStringValue(value.toString());
- break;
-
- case Binary:
- attrValue.setBinaryValue((byte[]) value);
- break;
-
- default:
- try {
- attrValue.parseValue(schema, value.toString());
- } catch (ParsingValidationException e) {
- LOG.error("While parsing provided value {}", value, e);
+ for (Object value : values) {
+ AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ if (value != null) {
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ switch (schemaType) {
+ case String:
attrValue.setStringValue(value.toString());
- schemaType = AttrSchemaType.String;
- }
- break;
+ break;
+
+ case Binary:
+ attrValue.setBinaryValue((byte[]) value);
+ break;
+
+ default:
+ try {
+ attrValue.parseValue(schema, value.toString());
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided value {}", value, e);
+ attrValue.setStringValue(value.toString());
+ schemaType = AttrSchemaType.String;
+ }
+ break;
+ }
+ attrTO.getValues().add(attrValue.getValueAsString(schemaType));
}
- attrTO.getValues().add(attrValue.getValueAsString(schemaType));
}
- }
- anyTO.getPlainAttrs().add(attrTO);
- break;
+ anyTO.getPlainAttrs().add(attrTO);
+ break;
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
- anyTO.getDerAttrs().add(attrTO);
- break;
+ case DERIVED:
+ attrTO = new AttrTO();
+ attrTO.setSchema(intAttrName.getSchemaName());
+ anyTO.getDerAttrs().add(attrTO);
+ break;
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
+ case VIRTUAL:
+ attrTO = new AttrTO();
+ attrTO.setSchema(intAttrName.getSchemaName());
- // virtual attributes don't get transformed, iterate over original attr.getValue()
- for (Object value : (attr == null || attr.getValue() == null)
- ? Collections.emptyList() : attr.getValue()) {
+ // virtual attributes don't get transformed, iterate over original attr.getValue()
+ for (Object value : (attr == null || attr.getValue() == null)
+ ? Collections.emptyList() : attr.getValue()) {
- if (value != null) {
- attrTO.getValues().add(value.toString());
+ if (value != null) {
+ attrTO.getValues().add(value.toString());
+ }
}
- }
- anyTO.getVirAttrs().add(attrTO);
- break;
+ anyTO.getVirAttrs().add(attrTO);
+ break;
- default:
+ default:
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 0ccbe14..ca94e16 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientCompositeException;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -38,7 +37,6 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.RelationshipTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.lib.types.ResourceOperation;
@@ -96,11 +94,6 @@ abstract class AbstractAnyDataBinder {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractAnyDataBinder.class);
- private static final IntMappingType[] FOR_MANDATORY = new IntMappingType[] {
- IntMappingType.AnyObjectPlainSchema, IntMappingType.AnyObjectDerivedSchema,
- IntMappingType.UserPlainSchema, IntMappingType.UserDerivedSchema,
- IntMappingType.GroupPlainSchema, IntMappingType.GroupDerivedSchema };
-
@Autowired
protected RealmDAO realmDAO;
@@ -224,10 +217,7 @@ abstract class AbstractAnyDataBinder {
if (provision != null) {
for (MappingItem item : provision.getMapping().getItems()) {
- if (ArrayUtils.contains(FOR_MANDATORY, item.getIntMappingType())
- && (item.getPurpose() == MappingPurpose.PROPAGATION
- || item.getPurpose() == MappingPurpose.BOTH)) {
-
+ if ((item.getPurpose() == MappingPurpose.PROPAGATION || item.getPurpose() == MappingPurpose.BOTH)) {
List<PlainAttrValue> values = mappingManager.getIntValues(
provision, item, Collections.<Any<?>>singletonList(any));
if (values.isEmpty() && JexlUtils.evaluateMandatoryCondition(item.getMandatoryCondition(), any)) {
@@ -351,9 +341,7 @@ abstract class AbstractAnyDataBinder {
for (MappingItem mapItem
: MappingManagerImpl.getPropagationMappingItems(resource.getProvision(any.getType()))) {
- if (schema.getKey().equals(mapItem.getIntAttrName())
- && mapItem.getIntMappingType() == anyUtils.plainIntMappingType()) {
-
+ if (schema.getKey().equals(mapItem.getIntAttrName())) {
propByRes.add(ResourceOperation.UPDATE, resource.getKey());
if (mapItem.isConnObjectKey() && !attr.getValuesAsStrings().isEmpty()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
index eb0c328..a9de5bd 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/NotificationDataBinderImpl.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.core.provisioning.api.data.NotificationDataBinder;
import org.apache.syncope.common.lib.to.NotificationTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.Notification;
@@ -33,7 +34,9 @@ import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.MailTemplateDAO;
import org.apache.syncope.core.persistence.api.entity.AnyAbout;
import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.MailTemplate;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,6 +58,9 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
@Autowired
private EntityFactory entityFactory;
+ @Autowired
+ private AnyUtilsFactory anyUtilsFactory;
+
@Override
public NotificationTO getNotificationTO(final Notification notification) {
NotificationTO result = new NotificationTO();
@@ -118,5 +124,8 @@ public class NotificationDataBinderImpl implements NotificationDataBinder {
return notificationTO.getAbouts().containsKey(anyAbout.getAnyType().getKey());
}
});
+
+ // 3. verify recipientAttrName
+ IntAttrNameParser.parse(notification.getRecipientAttrName(), anyUtilsFactory, AnyTypeKind.USER);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index e09972f..ddf5a14 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
@@ -48,11 +48,14 @@ import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.AnyType;
import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser.IntAttrName;
import org.apache.syncope.core.provisioning.api.data.ResourceDataBinder;
import org.apache.syncope.core.provisioning.api.utils.EntityUtils;
import org.identityconnectors.framework.common.objects.ObjectClass;
@@ -86,6 +89,9 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
@Autowired
private EntityFactory entityFactory;
+ @Autowired
+ private AnyUtilsFactory anyUtilsFactory;
+
@Override
public ExternalResource create(final ResourceTO resourceTO) {
return update(entityFactory.newEntity(ExternalResource.class), resourceTO);
@@ -259,44 +265,37 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
for (MappingItemTO itemTO : mappingTO.getItems()) {
- if (itemTO == null || itemTO.getIntMappingType() == null) {
- LOG.error("Null {} or missing {}",
- MappingItemTO.class.getSimpleName(), IntMappingType.class.getSimpleName());
- invalidMapping.getElements().add(
- "Null " + MappingItemTO.class.getSimpleName()
- + " or missing " + IntMappingType.class.getSimpleName());
+ if (itemTO == null) {
+ LOG.error("Null {}", MappingItemTO.class.getSimpleName());
+ invalidMapping.getElements().add("Null " + MappingItemTO.class.getSimpleName());
} else {
if (itemTO.getIntAttrName() == null) {
- if (IntMappingType.getEmbedded().contains(itemTO.getIntMappingType())) {
- itemTO.setIntAttrName(itemTO.getIntMappingType().toString());
- } else {
- requiredValuesMissing.getElements().add("intAttrName");
- scce.addException(requiredValuesMissing);
- }
+ requiredValuesMissing.getElements().add("intAttrName");
+ scce.addException(requiredValuesMissing);
}
- boolean allowed;
- switch (itemTO.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- allowed = allowedSchemas.getPlainSchemas().contains(itemTO.getIntAttrName());
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- allowed = allowedSchemas.getDerSchemas().contains(itemTO.getIntAttrName());
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- allowed = allowedSchemas.getVirSchemas().contains(itemTO.getIntAttrName());
- break;
-
- default:
- allowed = true;
+ IntAttrName intAttrName = IntAttrNameParser.parse(
+ itemTO.getIntAttrName(),
+ anyUtilsFactory,
+ mapping.getProvision().getAnyType().getKind());
+
+ boolean allowed = true;
+ if (intAttrName.getSchemaType() != null) {
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ allowed = allowedSchemas.getPlainSchemas().contains(itemTO.getIntAttrName());
+ break;
+
+ case DERIVED:
+ allowed = allowedSchemas.getDerSchemas().contains(itemTO.getIntAttrName());
+ break;
+
+ case VIRTUAL:
+ allowed = allowedSchemas.getVirSchemas().contains(itemTO.getIntAttrName());
+ break;
+
+ default:
+ }
}
if (allowed) {
@@ -314,6 +313,13 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
BeanUtils.copyProperties(itemTO, item, MAPPINGITEM_IGNORE_PROPERTIES);
item.setMapping(mapping);
if (item.isConnObjectKey()) {
+ if (intAttrName.getSchemaType() == SchemaType.VIRTUAL) {
+ throw new IllegalArgumentException("Virtual attributes cannot be set as ConnObjectKey");
+ }
+ if ("password".equals(intAttrName.getField())) {
+ throw new IllegalArgumentException("Password attributes cannot be set as ConnObjectKey");
+ }
+
mapping.setConnObjectKeyItem(item);
} else {
mapping.add(item);
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index af872c1..d0229f9 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -33,7 +33,6 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.AuditLoggerName;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -63,10 +62,13 @@ import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyAbout;
import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.provisioning.api.DerAttrHandler;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser.IntAttrName;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
@@ -150,6 +152,9 @@ public class NotificationManagerImpl implements NotificationManager {
@Autowired
private EntityFactory entityFactory;
+ @Autowired
+ private AnyUtilsFactory anyUtilsFactory;
+
@Transactional(readOnly = true)
@Override
public long getMaxRetries() {
@@ -190,8 +195,7 @@ public class NotificationManagerImpl implements NotificationManager {
for (User recipient : recipients) {
virAttrHander.getValues(recipient);
- String email = getRecipientEmail(notification.getRecipientAttrType(),
- notification.getRecipientAttrName(), recipient);
+ String email = getRecipientEmail(notification.getRecipientAttrName(), recipient);
if (email == null) {
LOG.warn("{} cannot be notified: {} not found", recipient, notification.getRecipientAttrName());
} else {
@@ -339,43 +343,43 @@ public class NotificationManagerImpl implements NotificationManager {
return notifications;
}
- private String getRecipientEmail(
- final IntMappingType recipientAttrType, final String recipientAttrName, final User user) {
-
+ private String getRecipientEmail(final String recipientAttrName, final User user) {
String email = null;
- switch (recipientAttrType) {
- case Username:
- email = user.getUsername();
- break;
+ IntAttrName intAttrName = IntAttrNameParser.parse(recipientAttrName, anyUtilsFactory, AnyTypeKind.USER);
- case UserPlainSchema:
- UPlainAttr attr = user.getPlainAttr(recipientAttrName);
- if (attr != null) {
- email = attr.getValuesAsStrings().isEmpty() ? null : attr.getValuesAsStrings().get(0);
- }
- break;
-
- case UserDerivedSchema:
- DerSchema schema = derSchemaDAO.find(recipientAttrName);
- if (schema == null) {
- LOG.warn("Ignoring non existing {} {}", DerSchema.class.getSimpleName(), recipientAttrName);
- } else {
- email = derAttrHander.getValue(user, schema);
- }
- break;
-
- case UserVirtualSchema:
- VirSchema virSchema = virSchemaDAO.find(recipientAttrName);
- if (virSchema == null) {
- LOG.warn("Ignoring non existing {} {}", VirSchema.class.getSimpleName(), recipientAttrName);
- } else {
- List<String> virAttrValues = virAttrHander.getValues(user, virSchema);
- email = virAttrValues.isEmpty() ? null : virAttrValues.get(0);
- }
- break;
+ if ("username".equals(intAttrName.getField())) {
+ email = user.getUsername();
+ } else if (intAttrName.getSchemaType() != null) {
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ UPlainAttr attr = user.getPlainAttr(recipientAttrName);
+ if (attr != null) {
+ email = attr.getValuesAsStrings().isEmpty() ? null : attr.getValuesAsStrings().get(0);
+ }
+ break;
+
+ case DERIVED:
+ DerSchema schema = derSchemaDAO.find(recipientAttrName);
+ if (schema == null) {
+ LOG.warn("Ignoring non existing {} {}", DerSchema.class.getSimpleName(), recipientAttrName);
+ } else {
+ email = derAttrHander.getValue(user, schema);
+ }
+ break;
+
+ case VIRTUAL:
+ VirSchema virSchema = virSchemaDAO.find(recipientAttrName);
+ if (virSchema == null) {
+ LOG.warn("Ignoring non existing {} {}", VirSchema.class.getSimpleName(), recipientAttrName);
+ } else {
+ List<String> virAttrValues = virAttrHander.getValues(user, virSchema);
+ email = virAttrValues.isEmpty() ? null : virAttrValues.get(0);
+ }
+ break;
- default:
+ default:
+ }
}
return email;
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
index 995f483..a2c9271 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java
@@ -47,6 +47,8 @@ import org.apache.syncope.core.persistence.api.entity.resource.Provision;
import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.Connector;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser;
+import org.apache.syncope.core.provisioning.api.IntAttrNameParser.IntAttrName;
import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeUtil;
@@ -155,10 +157,10 @@ public class PullUtils {
return result;
}
- private AnyDAO<?> getAnyDAO(final MappingItem connObjectKeyItem) {
- return AnyTypeKind.USER == connObjectKeyItem.getIntMappingType().getAnyTypeKind()
+ private AnyDAO<?> getAnyDAO(final AnyTypeKind anyTypeKind) {
+ return AnyTypeKind.USER == anyTypeKind
? userDAO
- : AnyTypeKind.ANY_OBJECT == connObjectKeyItem.getIntMappingType().getAnyTypeKind()
+ : AnyTypeKind.ANY_OBJECT == anyTypeKind
? anyObjectDAO
: groupDAO;
}
@@ -181,72 +183,70 @@ public class PullUtils {
}
}
- switch (connObjectKeyItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- PlainAttrValue value = anyUtils.newPlainAttrValue();
+ IntAttrName intAttrName = IntAttrNameParser.parse(
+ connObjectKeyItem.getIntAttrName(),
+ anyUtilsFactory,
+ provision.getAnyType().getKind());
+
+ if (intAttrName.getField() != null) {
+ switch (intAttrName.getField()) {
+ case "key":
+ Any<?> any = getAnyDAO(provision.getAnyType().getKind()).find(transfUid);
+ if (any != null) {
+ result.add(any.getKey());
+ }
+ break;
- PlainSchema schema = plainSchemaDAO.find(connObjectKeyItem.getIntAttrName());
- if (schema == null) {
- value.setStringValue(transfUid);
- } else {
- try {
- value.parseValue(schema, transfUid);
- } catch (ParsingValidationException e) {
- LOG.error("While parsing provided __UID__ {}", transfUid, e);
- value.setStringValue(transfUid);
+ case "username":
+ User user = userDAO.findByUsername(transfUid);
+ if (user != null) {
+ result.add(user.getKey());
}
- }
+ break;
- List<? extends Any<?>> anys =
- getAnyDAO(connObjectKeyItem).findByAttrValue(connObjectKeyItem.getIntAttrName(), value);
- for (Any<?> any : anys) {
- result.add(any.getKey());
- }
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- anys = getAnyDAO(connObjectKeyItem).findByDerAttrValue(connObjectKeyItem.getIntAttrName(), transfUid);
- for (Any<?> any : anys) {
- result.add(any.getKey());
- }
- break;
-
- case UserKey:
- case GroupKey:
- case AnyObjectKey:
- Any<?> any = getAnyDAO(connObjectKeyItem).find(transfUid);
- if (any != null) {
- result.add(any.getKey());
- }
- break;
+ case "name":
+ Group group = groupDAO.findByName(transfUid);
+ if (group != null) {
+ result.add(group.getKey());
+ }
+ AnyObject anyObject = anyObjectDAO.findByName(transfUid);
+ if (anyObject != null) {
+ result.add(anyObject.getKey());
+ }
+ break;
+ }
+ } else if (intAttrName.getSchemaType() != null) {
+ switch (intAttrName.getSchemaType()) {
+ case PLAIN:
+ PlainAttrValue value = anyUtils.newPlainAttrValue();
- case Username:
- User user = userDAO.findByUsername(transfUid);
- if (user != null) {
- result.add(user.getKey());
- }
- break;
+ PlainSchema schema = plainSchemaDAO.find(intAttrName.getSchemaName());
+ if (schema == null) {
+ value.setStringValue(transfUid);
+ } else {
+ try {
+ value.parseValue(schema, transfUid);
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided __UID__ {}", transfUid, e);
+ value.setStringValue(transfUid);
+ }
+ }
- case GroupName:
- Group group = groupDAO.findByName(transfUid);
- if (group != null) {
- result.add(group.getKey());
- }
- break;
+ List<? extends Any<?>> anys = getAnyDAO(provision.getAnyType().getKind()).
+ findByAttrValue(intAttrName.getSchemaName(), value);
+ for (Any<?> any : anys) {
+ result.add(any.getKey());
+ }
+ break;
- case AnyObjectName:
- AnyObject anyObject = anyObjectDAO.findByName(transfUid);
- if (anyObject != null) {
- result.add(anyObject.getKey());
- }
- break;
-
- default:
- LOG.error("Invalid connObjectKey type '{}'", connObjectKeyItem.getIntMappingType());
+ case DERIVED:
+ anys = getAnyDAO(provision.getAnyType().getKind()).
+ findByDerAttrValue(intAttrName.getSchemaName(), transfUid);
+ for (Any<?> any : anys) {
+ result.add(any.getKey());
+ }
+ break;
+ }
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
index 26f35cc..cb1612a 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ResourceDataBinderTest.java
@@ -28,7 +28,6 @@ import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -89,7 +88,6 @@ public class ResourceDataBinderTest extends AbstractTest {
MappingItemTO item = new MappingItemTO();
item.setIntAttrName("userId");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("campo1");
item.setConnObjectKey(true);
item.setMandatoryCondition("false");
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java
index 574c147..c6bde9c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java
@@ -167,7 +167,7 @@ public class ConfigurationITCase extends AbstractITCase {
assertNotNull(e.getElements());
assertEquals(1, e.getElements().size());
- assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidName.name()));
+ assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidKey.name()));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
index beb4cf0..067022b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
@@ -57,7 +57,6 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ConnConfPropSchema;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.rest.api.service.ConnectorService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.apache.syncope.fit.AbstractITCase;
@@ -674,7 +673,6 @@ public class ConnectorITCase extends AbstractITCase {
MappingItemTO mapItem = new MappingItemTO();
mapItem.setExtAttrName("uid");
mapItem.setIntAttrName("userId");
- mapItem.setIntMappingType(IntMappingType.UserPlainSchema);
mapItem.setConnObjectKey(true);
mapping.setConnObjectKeyItem(mapItem);
// ----------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java
index 8597974..71a3814 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java
@@ -142,7 +142,7 @@ public class DerSchemaITCase extends AbstractITCase {
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidDerSchema, e.getType());
- assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidName.name()));
+ assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidKey.name()));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
index b654ac1..a09b9bb 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
@@ -76,7 +76,6 @@ import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.BulkMembersActionType;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
@@ -882,14 +881,12 @@ public class GroupITCase extends AbstractITCase {
MappingTO mapping = newLDAP.getProvision(AnyTypeKind.GROUP.name()).getMapping();
MappingItemTO connObjectKey = mapping.getConnObjectKeyItem();
- connObjectKey.setIntMappingType(IntMappingType.GroupDerivedSchema);
connObjectKey.setIntAttrName("displayProperty");
connObjectKey.setPurpose(MappingPurpose.PROPAGATION);
mapping.setConnObjectKeyItem(connObjectKey);
mapping.setConnObjectLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
MappingItemTO description = new MappingItemTO();
- description.setIntMappingType(IntMappingType.GroupKey);
description.setExtAttrName("description");
description.setPurpose(MappingPurpose.BOTH);
mapping.add(description);
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
index 1cec39a..a89fae3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MigrationITCase.java
@@ -49,7 +49,6 @@ import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.ConnConfPropSchema;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PullMode;
import org.apache.syncope.common.lib.types.SchemaType;
@@ -260,7 +259,6 @@ public class MigrationITCase extends AbstractTaskITCase {
MappingItemTO item = new MappingItemTO();
item.setIntAttrName("username");
- item.setIntMappingType(IntMappingType.Username);
item.setExtAttrName("username");
item.setMandatoryCondition("true");
item.setPurpose(MappingPurpose.PULL);
@@ -269,7 +267,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setPassword(true);
item.setIntAttrName("password");
- item.setIntMappingType(IntMappingType.Password);
item.setExtAttrName("__PASSWORD__");
item.setMandatoryCondition("true");
item.setPurpose(MappingPurpose.PULL);
@@ -277,7 +274,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName(MIGRATION_CIPHER_ALGORITHM);
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("cipherAlgorithm");
item.setMandatoryCondition("true");
item.setPurpose(MappingPurpose.PULL);
@@ -285,7 +281,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("surname");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("surname");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -293,7 +288,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("email");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("email");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -301,7 +295,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("firstname");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("firstname");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -309,7 +302,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("ctype");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("type");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -317,7 +309,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("gender");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("gender");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -325,7 +316,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("loginDate");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("loginDate");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -333,7 +323,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName(MIGRATION_RESOURCES_SCHEMA);
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("__RESOURCES__");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -351,7 +340,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("groupName");
- item.setIntMappingType(IntMappingType.GroupName);
item.setExtAttrName("name");
item.setMandatoryCondition("true");
item.setPurpose(MappingPurpose.PULL);
@@ -359,7 +347,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("show");
- item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setExtAttrName("show");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -367,7 +354,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("title");
- item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setExtAttrName("title");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -375,7 +361,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName("icon");
- item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setExtAttrName("icon");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -383,7 +368,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName(MIGRATION_RESOURCES_SCHEMA);
- item.setIntMappingType(IntMappingType.GroupPlainSchema);
item.setExtAttrName("__RESOURCES__");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
@@ -391,7 +375,6 @@ public class MigrationITCase extends AbstractTaskITCase {
item = new MappingItemTO();
item.setIntAttrName(MIGRATION_MEMBERSHIPS_SCHEMA);
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setExtAttrName("__MEMBERSHIPS__");
item.setMandatoryCondition("false");
item.setPurpose(MappingPurpose.PULL);
http://git-wip-us.apache.org/repos/asf/syncope/blob/c1dec4fd/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
index 97745c3..2c5b023 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java
@@ -44,7 +44,6 @@ import org.apache.syncope.common.lib.to.PullTaskTO;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.LoggerType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
@@ -157,21 +156,20 @@ public class MultitenancyITCase extends AbstractITCase {
MappingItemTO item = new MappingItemTO();
item.setIntAttrName("username");
- item.setIntMappingType(IntMappingType.Username);
item.setExtAttrName("cn");
item.setPurpose(MappingPurpose.BOTH);
mapping.setConnObjectKeyItem(item);
item = new MappingItemTO();
item.setPassword(true);
- item.setIntMappingType(IntMappingType.Password);
+ item.setIntAttrName("password");
item.setExtAttrName("userPassword");
item.setPurpose(MappingPurpose.BOTH);
item.setMandatoryCondition("true");
mapping.add(item);
item = new MappingItemTO();
- item.setIntMappingType(IntMappingType.UserKey);
+ item.setIntAttrName("key");
item.setPurpose(MappingPurpose.BOTH);
item.setExtAttrName("sn");
item.setMandatoryCondition("true");
@@ -179,7 +177,6 @@ public class MultitenancyITCase extends AbstractITCase {
item = new MappingItemTO();
item.setIntAttrName("email");
- item.setIntMappingType(IntMappingType.UserPlainSchema);
item.setPurpose(MappingPurpose.BOTH);
item.setExtAttrName("mail");
mapping.add(item);