← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14037: Made TrackedEntityAttributeValue extend BaseIdentifiableObject

 

------------------------------------------------------------
revno: 14037
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-02-15 15:06:39 +0100
message:
  Made TrackedEntityAttributeValue extend BaseIdentifiableObject
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeOption.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeOption.hbm.xml
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.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/trackedentity/TrackedEntityAttributeOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeOption.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeOption.java	2014-02-15 14:06:39 +0000
@@ -28,8 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.io.Serializable;
-
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 
@@ -43,17 +41,13 @@
  */
 @JacksonXmlRootElement( localName = "trackedEntityAttributeOption", namespace = DxfNamespaces.DXF_2_0 )
 public class TrackedEntityAttributeOption
-    implements Serializable
+    extends BaseIdentifiableObject
 {
     /**
      * Determines if a de-serialized file is compatible with this class.
      */
     private static final long serialVersionUID = 9052641474847384010L;
 
-    private int id;
-
-    private String name;
-
     private TrackedEntityAttribute attribute;
 
     // -------------------------------------------------------------------------
@@ -65,70 +59,9 @@
     }
 
     // -------------------------------------------------------------------------
-    // hashCode, equals and toString
-    // -------------------------------------------------------------------------
-
-    @Override
-    public int hashCode()
-    {
-        return name.hashCode();
-    }
-
-    @Override
-    public boolean equals( Object object )
-    {
-        if ( this == object )
-        {
-            return true;
-        }
-
-        if ( object == null )
-        {
-            return false;
-        }
-
-        if ( getClass() != object.getClass() )
-        {
-            return false;
-        }
-
-        final TrackedEntityAttributeOption other = (TrackedEntityAttributeOption) object;
-
-        return name.equals( other.getName() );
-    }
-
-    @Override
-    public String toString()
-    {
-        return "[" + name + "]";
-    }
-
-    // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
 
-    public int getId()
-    {
-        return id;
-    }
-
-    public void setId( int id )
-    {
-        this.id = id;
-    }
-
-    @JsonProperty
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
     @JsonProperty
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2014-02-14 16:13:55 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2014-02-15 14:06:39 +0000
@@ -395,6 +395,7 @@
 			<list>
 				<value>trackedentityattribute</value>
 				<value>trackedentityattributegroup</value>
+                <value>trackedentityattributevalue</value>
 				<value>program</value>
 				<value>programstage</value>
 				<value>programinstance</value>
@@ -512,15 +513,11 @@
 		<property name="arguments">
 			<list>
 				<list>
-					<ref
-						local="org.hisp.dhis.trackedentity.TrackedEntityInstanceDeletionHandler" />
-					<ref
-						local="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueDeletionHandler" />
+					<ref local="org.hisp.dhis.trackedentity.TrackedEntityInstanceDeletionHandler" />
+					<ref local="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueDeletionHandler" />
 					<ref local="org.hisp.dhis.relationship.RelationshipDeletionHandler" />
-					<ref
-						local="org.hisp.dhis.trackedentity.TrackedEntityAuditDeletionHandler" />
-					<ref
-						local="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueDeletionHandler" />
+					<ref local="org.hisp.dhis.trackedentity.TrackedEntityAuditDeletionHandler" />
+					<ref local="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramStageDeletionHandler" />
 					<ref local="org.hisp.dhis.program.ProgramStageSectionDeletionHandler" />

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeOption.hbm.xml	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeOption.hbm.xml	2014-02-15 14:06:39 +0000
@@ -1,14 +1,17 @@
 <?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
-
+  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+  [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+  >
+  
 <hibernate-mapping>
   <class name="org.hisp.dhis.trackedentity.TrackedEntityAttributeOption" table="trackedentityattributeoption">
 
     <id name="id" column="trackedentityattributeoptionid">
       <generator class="native" />
     </id>
+    &identifiableProperties;
 
     <property name="name" not-null="true" length="160" />
 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2014-02-13 14:24:59 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2014-02-15 14:06:39 +0000
@@ -84,6 +84,7 @@
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeOption;
 import org.hisp.dhis.trackedentity.TrackedEntityAudit;
 import org.hisp.dhis.trackedentity.TrackedEntityForm;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
@@ -536,6 +537,15 @@
     public void deleteTrackedEntityAttributeGroup( TrackedEntityAttributeGroup attributeGroup )
     {
     }
+    
+    public String allowDeleteTrackedEntityAttributeOption( TrackedEntityAttributeOption attributeOption )
+    {
+        return null;
+    }
+    
+    public void deleteTrackedEntityAttributeOption( TrackedEntityAttributeOption attributeOption )
+    {
+    }
 
     public String allowDeleteRelationship( Relationship relationship )
     {