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 2012/11/15 12:01:44 UTC
svn commit: r1409730 -
/incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
Author: ilgrosso
Date: Thu Nov 15 11:01:43 2012
New Revision: 1409730
URL: http://svn.apache.org/viewvc?rev=1409730&view=rev
Log:
Fixing getItems() call for role-only resources
Modified:
incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
Modified: incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java?rev=1409730&r1=1409729&r2=1409730&view=diff
==============================================================================
--- incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java (original)
+++ incubator/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java Thu Nov 15 11:01:43 2012
@@ -211,13 +211,13 @@ public abstract class AbstractAttributab
return Boolean.parseBoolean(jexlUtil.evaluate(mandatoryCondition, jexlContext));
}
- private boolean evaluateMandatoryCondition(final ExternalResource resource, final AbstractAttributable attributable,
- final String intAttrName, final IntMappingType intMappingType) {
+ private boolean evaluateMandatoryCondition(final AttributableUtil attrUtil, final ExternalResource resource,
+ final AbstractAttributable attributable, final String intAttrName, final IntMappingType intMappingType) {
boolean result = false;
final List<AbstractMappingItem> mappings = MappingUtil.getMatchingMappingItems(
- resource.getUmapping().getItems(), intAttrName, intMappingType);
+ attrUtil.getMappingItems(resource), intAttrName, intMappingType);
for (Iterator<AbstractMappingItem> itor = mappings.iterator(); itor.hasNext() && !result;) {
final AbstractMappingItem mapping = itor.next();
result |= evaluateMandatoryCondition(mapping.getMandatoryCondition(), attributable);
@@ -226,22 +226,22 @@ public abstract class AbstractAttributab
return result;
}
- private boolean evaluateMandatoryCondition(final AbstractAttributable attributable, final String intAttrName,
- final IntMappingType intMappingType) {
+ private boolean evaluateMandatoryCondition(final AttributableUtil attrUtil,
+ final AbstractAttributable attributable, final String intAttrName, final IntMappingType intMappingType) {
boolean result = false;
for (Iterator<ExternalResource> itor = attributable.getResources().iterator(); itor.hasNext() && !result;) {
final ExternalResource resource = itor.next();
if (resource.isEnforceMandatoryCondition()) {
- result |= evaluateMandatoryCondition(resource, attributable, intAttrName, intMappingType);
+ result |= evaluateMandatoryCondition(attrUtil, resource, attributable, intAttrName, intMappingType);
}
}
return result;
}
- private SyncopeClientException checkMandatory(final AttributableUtil attributableUtil,
+ private SyncopeClientException checkMandatory(final AttributableUtil attrUtil,
final AbstractAttributable attributable) {
SyncopeClientException reqValMissing = new SyncopeClientException(
@@ -250,31 +250,32 @@ public abstract class AbstractAttributab
LOG.debug("Check mandatory constraint among resources {}", attributable.getResources());
// Check if there is some mandatory schema defined for which no value has been provided
- for (AbstractSchema schema : schemaDAO.findAll(attributableUtil.schemaClass())) {
+ for (AbstractSchema schema : schemaDAO.findAll(attrUtil.schemaClass())) {
if (attributable.getAttribute(schema.getName()) == null
&& !schema.isReadonly()
&& (evaluateMandatoryCondition(schema.getMandatoryCondition(), attributable)
- || evaluateMandatoryCondition(attributable, schema.getName(), attributableUtil.intMappingType()))) {
+ || evaluateMandatoryCondition(attrUtil, attributable, schema.getName(),
+ attrUtil.intMappingType()))) {
LOG.error("Mandatory schema " + schema.getName() + " not provided with values");
reqValMissing.addElement(schema.getName());
}
}
- for (AbstractDerSchema derSchema : derSchemaDAO.findAll(attributableUtil.derSchemaClass())) {
+ for (AbstractDerSchema derSchema : derSchemaDAO.findAll(attrUtil.derSchemaClass())) {
if (attributable.getDerivedAttribute(derSchema.getName()) == null
- && evaluateMandatoryCondition(
- attributable, derSchema.getName(), attributableUtil.derIntMappingType())) {
+ && evaluateMandatoryCondition(attrUtil, attributable, derSchema.getName(),
+ attrUtil.derIntMappingType())) {
LOG.error("Mandatory derived schema " + derSchema.getName() + " does not evaluate to any value");
reqValMissing.addElement(derSchema.getName());
}
}
- for (AbstractVirSchema virSchema : virSchemaDAO.findAll(attributableUtil.virSchemaClass())) {
+ for (AbstractVirSchema virSchema : virSchemaDAO.findAll(attrUtil.virSchemaClass())) {
if (attributable.getAttribute(virSchema.getName()) == null
- && evaluateMandatoryCondition(
- attributable, virSchema.getName(), attributableUtil.virIntMappingType())) {
+ && evaluateMandatoryCondition(attrUtil, attributable, virSchema.getName(),
+ attrUtil.virIntMappingType())) {
LOG.error("Mandatory virtual schema " + virSchema.getName() + " not provided with values");