dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41674
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21249: Made DataEntryForm as Identifiable Object
------------------------------------------------------------
revno: 21249
committer: Amit Kumar Agrawal <amit.ku.agrawal@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-12-01 11:19:46 +0100
message:
Made DataEntryForm as Identifiable Object
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml
--
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/dataentryform/DataEntryForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java 2015-10-14 04:42:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java 2015-12-01 10:19:46 +0000
@@ -32,28 +32,24 @@
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DisplayDensity;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
-import java.io.Serializable;
+import java.util.Objects;
/**
* @author Bharath Kumar
*/
@JacksonXmlRootElement( localName = "dataEntryForm", namespace = DxfNamespaces.DXF_2_0 )
public class DataEntryForm
- implements Serializable
+ extends BaseIdentifiableObject
{
public static final int CURRENT_FORMAT = 2;
/**
- * The unique identifier for this DataEntryForm
- */
- private int id;
-
- /**
* Name of DataEntryForm. Required and unique.
*/
private String name;
@@ -83,13 +79,12 @@
public DataEntryForm( String name )
{
- this.name = name;
+ this(name,null);
}
public DataEntryForm( String name, String htmlCode )
{
- this.name = name;
- this.htmlCode = htmlCode;
+ this(name,null,htmlCode);
}
public DataEntryForm( String name, DisplayDensity style, String htmlCode )
@@ -115,33 +110,30 @@
// hashCode and equals
// -------------------------------------------------------------------------
- @Override
- public int hashCode()
+ @Override public int hashCode()
{
- return name.hashCode();
+ return 31 * super.hashCode() + Objects.hash( name, style, htmlCode, format );
}
- @Override
- public boolean equals( Object o )
+ @Override public boolean equals( Object obj )
{
- if ( this == o )
+ if ( this == obj )
{
return true;
}
-
- if ( o == null )
- {
- return false;
- }
-
- if ( !(o instanceof DataEntryForm) )
- {
- return false;
- }
-
- final DataEntryForm other = (DataEntryForm) o;
-
- return name.equals( other.getName() );
+ if ( obj == null || getClass() != obj.getClass() )
+ {
+ return false;
+ }
+ if ( !super.equals( obj ) )
+ {
+ return false;
+ }
+ final DataEntryForm other = (DataEntryForm) obj;
+ return Objects.equals( this.name, other.name )
+ && Objects.equals( this.style, other.style )
+ && Objects.equals( this.htmlCode, other.htmlCode )
+ && Objects.equals( this.format, other.format );
}
@Override
@@ -154,16 +146,6 @@
// Getters and setters
// -------------------------------------------------------------------------
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2015-11-17 09:50:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2015-12-01 10:19:46 +0000
@@ -117,7 +117,7 @@
if ( count > 0 )
{
- log.info( count + " last updated set on " + table );
+ log.info( count + " lastupdated set on " + table );
}
count = 0;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-11-30 03:36:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-12-01 10:19:46 +0000
@@ -1453,6 +1453,7 @@
<value>programrulevariable</value>
<value>relationshiptype</value>
<value>sqlview</value>
+ <value>dataentryform</value>
</list>
</property>
</bean>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml 2015-09-15 11:43:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataentryform/hibernate/DataEntryForm.hbm.xml 2015-12-01 10:19:46 +0000
@@ -1,7 +1,9 @@
<?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.dataentryform.DataEntryForm" table="dataentryform">
@@ -11,6 +13,7 @@
<id name="id" column="dataentryformid">
<generator class="native" />
</id>
+ &identifiableProperties;
<property name="name" not-null="true" unique="true" length="160" />