=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-11-24 07:06:45 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-11-24 08:36:54 +0000 @@ -298,7 +298,7 @@ { validationViolations.add( new ValidationViolation( attributeValue.getAttribute().getUid(), "Value '" + av.getValue() + "' already exists for attribute '" - + attributeValue.getAttribute().getName() + "' (" + attributeValue.getAttribute().getUid() + ")" ) ); + + attributeValue.getAttribute().getDisplayName() + "' (" + attributeValue.getAttribute().getUid() + ")" ) ); } } @@ -310,7 +310,17 @@ for ( String uid : attributeValueMap.keySet() ) { AttributeValue attributeValue = attributeValueMap.get( uid ); - mandatoryAttributes.remove( attributeValue.getAttribute() ); + + if ( !attributeValue.getAttribute().getSupportedClasses().contains( object.getClass() ) ) + { + validationViolations.add( new ValidationViolation( attributeValue.getAttribute().getUid(), + "Attribute '" + attributeValue.getAttribute().getDisplayName() + "' (" + attributeValue.getAttribute().getUid() + ") is not supported for type " + + object.getClass().getSimpleName() ) ); + } + else + { + mandatoryAttributes.remove( attributeValue.getAttribute() ); + } } mandatoryAttributes.stream()