dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14912
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5192: Removed check for duplicate codes in api as it is now enforced in db schema
------------------------------------------------------------
revno: 5192
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-11-22 13:27:29 +0100
message:
Removed check for duplicate codes in api as it is now enforced in db schema
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.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-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;
}