=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 2011-11-15 19:27:13 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java 2011-11-22 12:27:29 +0000 @@ -27,14 +27,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; -import java.util.*; /** * @author Bob Jolliffe @@ -49,8 +51,6 @@ */ private static final long serialVersionUID = 5532508099213570673L; - private final static Log log = LogFactory.getLog( AbstractNameableObject.class ); - /** * The database internal identifier for this Object. */ @@ -163,7 +163,7 @@ } /** - * Set autogenerated fields on save or update + * Set auto-generated fields on save or update */ public void setAutoFields() { @@ -234,19 +234,7 @@ String code = object.getCode(); int internalId = object.getId(); - if ( code == null ) - continue; - - // NOTE: its really not good that duplicate codes are possible - // Best we can do here is severe log and remove the item - if ( map.containsKey( code ) ) - { - log.warn( object.getClass() + ": Duplicate code " + code ); - map.remove( code ); - } else - { - map.put( code, internalId ); - } + map.put( code, internalId ); } return map; }