dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24709
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12158: made RelationshipType proper idObject. Added RelationshipTypeController.
------------------------------------------------------------
revno: 12158
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-19 10:33:39 +0200
message:
made RelationshipType proper idObject. Added RelationshipTypeController.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.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/relationship/RelationshipType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java 2013-09-11 15:26:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java 2013-09-19 08:33:39 +0000
@@ -28,19 +28,25 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DxfNamespaces;
-
/**
* @author Abyot Asalefew
* @version $Id$
*/
-@XmlRootElement( name = "relationshipType", namespace = DxfNamespaces.DXF_2_0 )
-@XmlAccessorType( value = XmlAccessType.NONE )
+@XmlRootElement(name = "relationshipType", namespace = DxfNamespaces.DXF_2_0)
+@XmlAccessorType(value = XmlAccessType.NONE)
public class RelationshipType
extends BaseIdentifiableObject
{
@@ -59,57 +65,23 @@
public RelationshipType()
{
+ setAutoFields();
}
public RelationshipType( String aIsToB, String bIsToA )
{
+ this();
this.aIsToB = aIsToB;
this.bIsToA = bIsToA;
}
// -------------------------------------------------------------------------
- // hashCode, equals and toString
- // -------------------------------------------------------------------------
-
- @Override
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( !getClass().isAssignableFrom( object.getClass() ) )
- {
- return false;
- }
-
- final RelationshipType other = (RelationshipType) object;
-
- return aIsToB.equals( other.getaIsToB() ) && bIsToA.equals( other.getbIsToA() );
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
-
- result = result * prime + aIsToB.hashCode();
- result = result * prime + bIsToA.hashCode();
-
- return result;
- }
-
- // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
public String getaIsToB()
{
return aIsToB;
@@ -120,6 +92,9 @@
this.aIsToB = aIsToB;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
public String getbIsToA()
{
return bIsToA;
@@ -129,4 +104,13 @@
{
this.bIsToA = bIsToA;
}
+
+ @Override
+ public String toString()
+ {
+ return "RelationshipType{" +
+ "aIsToB='" + aIsToB + '\'' +
+ ", bIsToA='" + bIsToA + '\'' +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java 2013-09-19 08:33:39 +0000
@@ -28,14 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
/**
* @author Abyot Asalefew Gizaw
* @version $Id$
*/
public interface RelationshipTypeStore
- extends GenericStore<RelationshipType>
+ extends GenericIdentifiableObjectStore<RelationshipType>
{
String ID = RelationshipTypeStore.class.getName();
=== 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 2013-09-13 07:40:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2013-09-19 08:33:39 +0000
@@ -54,7 +54,7 @@
"dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo", "map", "mapview",
"reporttable", "report", "messageconversation", "message", "userinfo", "usergroup", "userrole", "maplegend",
"maplegendset", "maplayer", "section", "optionset", "program", "programinstance", "programstage", "programstageinstance",
- "patient", "patientidentifier"
+ "patient", "patientidentifier", "relationshiptype"
};
private static final Map<String, String> TABLE_ID_MAP = DimensionalObjectUtils.asMap(
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2013-09-12 12:04:39 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java 2013-09-19 08:33:39 +0000
@@ -64,6 +64,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.sqlview.SqlView;
@@ -158,6 +159,7 @@
allExportClasses.put( Program.class, "programs" );
allExportClasses.put( ProgramStage.class, "programStages" );
+ allExportClasses.put( RelationshipType.class, "relationshipTypes" );
allExportClasses.put( BaseDimensionalObject.class, "dimensions" );
@@ -181,8 +183,10 @@
// tracker types are not enabled for meta-data import-export yet
exportClasses.remove( Program.class );
exportClasses.remove( ProgramStage.class );
+ exportClasses.remove( RelationshipType.class );
importClasses.remove( Program.class );
importClasses.remove( ProgramStage.class );
+ importClasses.remove( RelationshipType.class );
// special class which is created on demand in association with other objects
exportClasses.remove( DataElementOperand.class );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2013-09-19 08:33:39 +0000
@@ -68,6 +68,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.sqlview.SqlView;
@@ -118,7 +119,7 @@
private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
private List<Dashboard> dashboards = new ArrayList<Dashboard>();
-
+
private List<DataElement> dataElements = new ArrayList<DataElement>();
private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
@@ -126,7 +127,7 @@
private List<DataElementGroupSet> dataElementGroupSets = new ArrayList<DataElementGroupSet>();
private List<DimensionalObject> dimensions = new ArrayList<DimensionalObject>();
-
+
private List<Indicator> indicators = new ArrayList<Indicator>();
private List<IndicatorGroup> indicatorGroups = new ArrayList<IndicatorGroup>();
@@ -175,6 +176,8 @@
private List<ProgramStage> programStages = new ArrayList<ProgramStage>();
+ private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
+
public MetaData()
{
}
@@ -738,6 +741,19 @@
}
@JsonProperty
+ @JacksonXmlElementWrapper( localName = "relationshipTypes", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "relationshipType", namespace = DxfNamespaces.DXF_2_0 )
+ public List<RelationshipType> getRelationshipTypes()
+ {
+ return relationshipTypes;
+ }
+
+ public void setRelationshipTypes( List<RelationshipType> relationshipTypes )
+ {
+ this.relationshipTypes = relationshipTypes;
+ }
+
+ @JsonProperty
@JacksonXmlElementWrapper( localName = "dimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getDimensions()