=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2013-02-13 03:57:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2013-02-22 05:43:28 +0000 @@ -150,11 +150,6 @@ return inherit; } - public Boolean isGroupBy() - { - return groupBy; - } - public void setGroupBy( Boolean groupBy ) { this.groupBy = groupBy; === modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2012-12-06 09:21:56 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2013-02-22 05:43:28 +0000 @@ -31,13 +31,17 @@ import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.IdentifiableObject; import org.hisp.dhis.common.IdentifiableObjectManager; -import org.hisp.dhis.common.NameableObject; -import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.PeriodStore; import org.hisp.dhis.period.PeriodType; import org.springframework.beans.factory.annotation.Autowired; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; /** * @author Morten Olav Hansen @@ -63,8 +67,6 @@ private static final List> registeredTypes = new ArrayList>(); - private static final List> shortNameNotUnique = new ArrayList>(); - private Map, Collection> masterMap; private Map periodTypeMap; @@ -73,10 +75,6 @@ private Map, Map> codeMap; - private Map, Map> nameMap; - - private Map, Map> shortNameMap; - private boolean writeEnabled = true; //------------------------------------------------------------------------------------------------------- @@ -91,8 +89,6 @@ { registeredTypes.add( clazz ); } - - shortNameNotUnique.add( OrganisationUnit.class ); } @Override @@ -104,8 +100,6 @@ periodTypeMap = new HashMap(); uidMap = new HashMap, Map>(); codeMap = new HashMap, Map>(); - nameMap = new HashMap, Map>(); - shortNameMap = new HashMap, Map>(); for ( Class type : registeredTypes ) { @@ -113,8 +107,6 @@ populateIdentifiableObjectMap( type ); populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.UID ); populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.CODE ); - populateIdentifiableObjectMap( type, IdentifiableObject.IdentifiableProperty.NAME ); - populateNameableObjectMap( type, NameableObject.NameableProperty.SHORT_NAME ); } log.info( "Finished updating lookup maps at " + new Date() ); @@ -126,8 +118,6 @@ masterMap = null; uidMap = null; codeMap = null; - nameMap = null; - shortNameMap = null; periodTypeMap = null; writeEnabled = true; @@ -137,7 +127,7 @@ // Populate Helpers //------------------------------------------------------------------------------------------------------- - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") private void populateIdentifiableObjectMap( Class clazz ) { Collection map = new ArrayList(); @@ -153,7 +143,7 @@ } } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") private void populateIdentifiableObjectMap( Class clazz, IdentifiableObject.IdentifiableProperty property ) { Map map = new HashMap(); @@ -173,29 +163,6 @@ { codeMap.put( (Class) clazz, map ); } - else if ( property == IdentifiableObject.IdentifiableProperty.NAME ) - { - nameMap.put( (Class) clazz, map ); - } - } - } - - @SuppressWarnings( "unchecked" ) - private void populateNameableObjectMap( Class clazz, NameableObject.NameableProperty property ) - { - Map map = null; - - if ( NameableObject.class.isAssignableFrom( clazz ) ) - { - map = (Map) manager.getIdMap( (Class) clazz, property ); - } - - if ( map != null ) - { - if ( property == NameableObject.NameableProperty.SHORT_NAME ) - { - shortNameMap.put( (Class) clazz, map ); - } } } @@ -296,7 +263,7 @@ } @Override - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public Collection getAllObjects( Class clazz ) { return (Collection) masterMap.get( clazz ); @@ -328,7 +295,7 @@ // Internal Methods //------------------------------------------------------------------------------------------------------- - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") private Collection _findMatches( T object ) { Collection objects = new HashSet(); @@ -367,31 +334,6 @@ objects.add( (T) match ); } } - - if ( identifiableObject.getName() != null ) - { - IdentifiableObject match = getNameMatch( identifiableObject ); - - if ( match != null ) - { - objects.add( (T) match ); - } - } - } - - if ( NameableObject.class.isInstance( object ) ) - { - NameableObject nameableObject = (NameableObject) object; - - if ( _shortNameUnique( object ) && nameableObject.getShortName() != null ) - { - IdentifiableObject match = getShortNameMatch( nameableObject ); - - if ( match != null ) - { - objects.add( (T) match ); - } - } } return objects; @@ -428,37 +370,6 @@ map.put( identifiableObject.getCode(), identifiableObject ); } - - if ( identifiableObject.getName() != null ) - { - Map map = nameMap.get( identifiableObject.getClass() ); - - if ( map == null ) - { - // might be dynamically sub-classed by javassist or cglib, fetch superclass and try again - map = nameMap.get( identifiableObject.getClass().getSuperclass() ); - } - - map.put( identifiableObject.getName(), identifiableObject ); - } - } - - if ( NameableObject.class.isInstance( object ) ) - { - NameableObject nameableObject = (NameableObject) object; - - if ( _shortNameUnique( object ) && nameableObject.getShortName() != null ) - { - Map map = shortNameMap.get( nameableObject.getClass() ); - - if ( map == null ) - { - // might be dynamically sub-classed by javassist or cglib, fetch superclass and try again - map = shortNameMap.get( nameableObject.getClass().getSuperclass() ); - } - - map.put( nameableObject.getShortName(), nameableObject ); - } } } @@ -486,30 +397,6 @@ return null; } - private IdentifiableObject getNameMatch( IdentifiableObject identifiableObject ) - { - Map map = nameMap.get( identifiableObject.getClass() ); - - if ( map != null ) - { - return map.get( identifiableObject.getName() ); - } - - return null; - } - - private NameableObject getShortNameMatch( NameableObject nameableObject ) - { - Map map = shortNameMap.get( nameableObject.getClass() ); - - if ( map != null ) - { - return map.get( nameableObject.getShortName() ); - } - - return null; - } - private boolean _typeSupported( Class clazz ) { for ( Class c : registeredTypes ) @@ -522,17 +409,4 @@ return false; } - - private boolean _shortNameUnique( T object ) - { - for ( Class clazz : shortNameNotUnique ) - { - if ( clazz.isAssignableFrom( object.getClass() ) ) - { - return false; - } - } - - return true; - } }