dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21156
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9936: added new property to idObject, isAutoGenerated.
------------------------------------------------------------
revno: 9936
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-01 12:40:28 +0700
message:
added new property to idObject, isAutoGenerated.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.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/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-02-25 12:33:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2013-03-01 05:40:28 +0000
@@ -200,6 +200,12 @@
return true;
}
+ @Override
+ public boolean isAutoGenerated()
+ {
+ return false;
+ }
+
@JsonProperty
@JacksonXmlProperty( isAttribute = true )
public Date getCreated()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2013-02-13 01:17:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2013-03-01 05:40:28 +0000
@@ -51,6 +51,8 @@
boolean haveUniqueNames();
+ boolean isAutoGenerated();
+
String getCode();
Date getCreated();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/concept/Concept.java 2013-03-01 05:40:28 +0000
@@ -27,11 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
/**
* A Concept Name is a short name which is used as an attribute name
* when representing a data value in xml which does not use
@@ -41,7 +40,7 @@
*
* @author Dang Duy Hieu
*/
-@JacksonXmlRootElement( localName = "concept", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement(localName = "concept", namespace = DxfNamespaces.DXF_2_0)
public class Concept
extends BaseIdentifiableObject
{
@@ -97,4 +96,10 @@
{
return "[" + name + "]";
}
+
+ @Override
+ public boolean isAutoGenerated()
+ {
+ return name != null && name.equals( DEFAULT_CONCEPT_NAME );
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2013-03-01 05:21:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2013-03-01 05:40:28 +0000
@@ -288,6 +288,7 @@
return map;
}
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
@@ -299,6 +300,12 @@
}
@Override
+ public boolean isAutoGenerated()
+ {
+ return isDefault();
+ }
+
+ @Override
public String getName()
{
if ( name != null )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2013-02-13 03:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2013-03-01 05:40:28 +0000
@@ -27,6 +27,20 @@
* 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.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+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.DxfNamespaces;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.annotation.Scanned;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -35,25 +49,10 @@
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.annotation.Scanned;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.common.view.DetailedView;
-import org.hisp.dhis.common.view.ExportView;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
/**
* @author Kristian Nordal
*/
-@JacksonXmlRootElement( localName = "organisationUnitGroupSet", namespace = DxfNamespaces.DXF_2_0)
+@JacksonXmlRootElement(localName = "organisationUnitGroupSet", namespace = DxfNamespaces.DXF_2_0)
public class OrganisationUnitGroupSet
extends BaseIdentifiableObject
{
@@ -195,9 +194,15 @@
// Getters and setters
// -------------------------------------------------------------------------
+ @Override
+ public boolean isAutoGenerated()
+ {
+ return name != null && (name.equals( "Type" ) || name.equals( "Ownership" ));
+ }
+
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getDescription()
{
return description;
@@ -209,8 +214,8 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public boolean isCompulsory()
{
return compulsory;
@@ -221,11 +226,11 @@
this.compulsory = compulsory;
}
- @JsonProperty( value = "organisationUnitGroups" )
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0)
- @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0)
+ @JsonProperty(value = "organisationUnitGroups")
+ @JsonSerialize(contentAs = BaseIdentifiableObject.class)
+ @JsonView({ DetailedView.class, ExportView.class })
+ @JacksonXmlElementWrapper(localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0)
public Set<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;