← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14273: when creating new TEIs through the web-api, do not check for mandatory attributes. Mandatory attr...

 

------------------------------------------------------------
revno: 14273
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-03-18 11:05:39 +0100
message:
  when creating new TEIs through the web-api, do not check for mandatory attributes. Mandatory attribute property will be moved to programAttribute.
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-03-18 10:05:39 +0000
@@ -282,28 +282,6 @@
     private List<ImportConflict> checkAttributes( TrackedEntityInstance trackedEntityInstance )
     {
         List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
-        Collection<TrackedEntityAttribute> entityAttributes = manager.getAll( TrackedEntityAttribute.class );
-        Set<String> cache = new HashSet<String>();
-
-        for ( Attribute attribute : trackedEntityInstance.getAttributes() )
-        {
-            if ( attribute.getValue() != null )
-            {
-                cache.add( attribute.getAttribute() );
-            }
-        }
-
-        for ( TrackedEntityAttribute entityAttribute : entityAttributes )
-        {
-            if ( entityAttribute.isMandatory() )
-            {
-                if ( !cache.contains( entityAttribute.getUid() ) )
-                {
-                    importConflicts.add( new ImportConflict( "Attribute.type", "Missing required attribute type "
-                        + entityAttribute.getUid() ) );
-                }
-            }
-        }
 
         for ( Attribute attribute : trackedEntityInstance.getAttributes() )
         {
@@ -312,8 +290,8 @@
 
             if ( entityAttribute == null )
             {
-                importConflicts
-                    .add( new ImportConflict( "Attribute.type", "Invalid type " + attribute.getAttribute() ) );
+                importConflicts.add( new ImportConflict( "Attribute.type", "Invalid type "
+                    + attribute.getAttribute() ) );
             }
         }
 
@@ -330,8 +308,8 @@
 
             if ( relationshipType == null )
             {
-                importConflicts
-                    .add( new ImportConflict( "Relationship.type", "Invalid type " + relationship.getType() ) );
+                importConflicts.add( new ImportConflict( "Relationship.type", "Invalid type "
+                    + relationship.getType() ) );
             }
 
             org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = manager.get( org.hisp.dhis.trackedentity.TrackedEntityInstance.class, relationship.getTrackedEntityInstance() );