dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15090
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5312: dxf2merge: more explicit element names + more
Merge authors:
Bob Jolliffe bobjolliffe@xxxxxxxxx
Morten Olav Hansen (mortenoh)
------------------------------------------------------------
revno: 5312 [merge]
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-06 19:29:14 +0100
message:
dxf2merge: more explicit element names + more
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/list.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/model2fop.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/chart.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/indicator.xsl
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl
--
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/adapter/JsonIdentifiableObjectSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java 2011-12-06 11:36:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonIdentifiableObjectSerializer.java 2011-12-06 18:18:18 +0000
@@ -51,7 +51,7 @@
{
jgen.writeStartObject();
- jgen.writeStringField( "uid", value.getUid() );
+ jgen.writeStringField( "id", value.getUid() );
jgen.writeStringField( "name", value.getName() );
jgen.writeFieldName( "lastUpdated" );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java 2011-12-06 11:36:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonNameableObjectSerializer.java 2011-12-06 18:18:18 +0000
@@ -51,7 +51,7 @@
{
jgen.writeStartObject();
- jgen.writeStringField( "uid", nameableObject.getUid() );
+ jgen.writeStringField( "id", nameableObject.getUid() );
jgen.writeStringField( "name", nameableObject.getName() );
jgen.writeFieldName( "lastUpdated" );
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/adapter/JsonSetSerializer.java 2011-12-06 17:52:58 +0000
@@ -0,0 +1,55 @@
+package org.hisp.dhis.common.adapter;
+
+/*
+ * Copyright (c) 2004-2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.map.JsonSerializer;
+import org.codehaus.jackson.map.SerializerProvider;
+
+import java.io.IOException;
+import java.util.Set;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class JsonSetSerializer extends JsonSerializer<Set<Object>>
+{
+ @Override
+ public void serialize( Set<Object> objects, JsonGenerator jgen, SerializerProvider provider ) throws IOException, JsonProcessingException
+ {
+ jgen.writeStartArray();
+
+ for ( Object object : objects )
+ {
+ jgen.writeObject( object );
+ }
+
+ jgen.writeEndArray();
+ }
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-06 11:41:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2011-12-06 17:30:12 +0000
@@ -465,8 +465,8 @@
this.url = url;
}
- @XmlElementWrapper( name = "groups" )
- @XmlElement( name = "group" )
+ @XmlElementWrapper( name = "dataElementGroups" )
+ @XmlElement( name = "dataElementGroup" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<DataElementGroup> getGroups()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2011-12-06 17:37:30 +0000
@@ -30,8 +30,7 @@
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
-import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer;
+import org.hisp.dhis.common.adapter.*;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -145,9 +144,9 @@
// Getters and setters
// -------------------------------------------------------------------------
- @XmlElementWrapper( name = "members" )
+ @XmlElementWrapper( name = "dataElements" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @XmlElement( name = "member" )
+ @XmlElement( name = "dataElement" )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<DataElement> getMembers()
{
@@ -159,6 +158,9 @@
this.members = members;
}
+ @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlElement( name = "dataElementGroupSet" )
+ @JsonSerialize( using = JsonIdentifiableObjectSerializer.class )
public DataElementGroupSet getGroupSet()
{
return groupSet;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2011-12-06 17:37:30 +0000
@@ -219,9 +219,9 @@
this.compulsory = compulsory;
}
- @XmlElementWrapper( name = "members" )
+ @XmlElementWrapper( name = "dataElementGroups" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @XmlElement( name = "member" )
+ @XmlElement( name = "dataElementGroup" )
@JsonSerialize( using = JsonIdentifiableObjectListSerializer.class )
public List<DataElementGroup> getMembers()
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-06 11:41:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2011-12-06 17:52:58 +0000
@@ -31,10 +31,7 @@
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.Dxf2Namespace;
-import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.BaseNameableObjectXmlAdapter;
-import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer;
-import org.hisp.dhis.common.adapter.JsonNameableObjectSetSerializer;
+import org.hisp.dhis.common.adapter.*;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -346,8 +343,8 @@
this.compulsoryDataElementOperands = compulsoryDataElementOperands;
}
- @XmlElementWrapper( name = "sources" )
- @XmlElement( name = "source" )
+ @XmlElementWrapper( name = "organisationUnits" )
+ @XmlElement( name = "organisationUnit" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<OrganisationUnit> getSources()
@@ -373,6 +370,7 @@
@XmlElementWrapper( name = "sections" )
@XmlElement( name = "section" )
@JsonProperty
+ @JsonSerialize( using = JsonSetSerializer.class )
public Set<Section> getSections()
{
return sections;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-06 11:41:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java 2011-12-06 17:52:58 +0000
@@ -188,9 +188,6 @@
this.name = name;
}
- @XmlElement
- @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public DataSet getDataSet()
{
return dataSet;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-06 11:41:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2011-12-06 17:30:12 +0000
@@ -42,7 +42,6 @@
/**
* @author Lars Helge Overland
- * @version $Id: Indicator.java 5540 2008-08-19 10:47:07Z larshelg $
*/
@XmlRootElement( name = "indicator", namespace = Dxf2Namespace.NAMESPACE )
@XmlAccessorType( value = XmlAccessType.NONE )
@@ -276,9 +275,9 @@
this.url = url;
}
- @XmlElementWrapper( name = "groups" )
+ @XmlElementWrapper( name = "indicatorGroups" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @XmlElement( name = "group" )
+ @XmlElement( name = "indicatorGroup" )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<IndicatorGroup> getGroups()
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2011-12-06 17:37:30 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
import org.hisp.dhis.common.adapter.BaseIdentifiableObjectXmlAdapter;
+import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSerializer;
import org.hisp.dhis.common.adapter.JsonIdentifiableObjectSetSerializer;
import javax.xml.bind.annotation.*;
@@ -142,9 +143,9 @@
// Getters and setters
// -------------------------------------------------------------------------
- @XmlElementWrapper( name = "members" )
+ @XmlElementWrapper( name = "indicators" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @XmlElement( name = "member" )
+ @XmlElement( name = "indicator" )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<Indicator> getMembers()
{
@@ -156,6 +157,9 @@
this.members = members;
}
+ @XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
+ @XmlElement( name = "indicatorGroupSet" )
+ @JsonSerialize( using = JsonIdentifiableObjectSerializer.class )
public IndicatorGroupSet getGroupSet()
{
return groupSet;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2011-12-06 17:37:30 +0000
@@ -220,9 +220,9 @@
this.compulsory = compulsory;
}
- @XmlElementWrapper( name = "members" )
+ @XmlElementWrapper( name = "indicatorGroups" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
- @XmlElement( name = "member" )
+ @XmlElement( name = "indicatorGroup" )
@JsonSerialize( using = JsonIdentifiableObjectListSerializer.class )
public List<IndicatorGroup> getMembers()
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-05 16:53:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-06 18:18:18 +0000
@@ -112,22 +112,26 @@
private boolean hasPatients;
+ /**
+ * Set of the dynamic attributes values that belong to this
+ * organisationUnit.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
+ /*
+ * Transient fields
+ */
+
+ private transient boolean currentParent;
+
private transient int level;
- private transient boolean currentParent;
-
private transient String type;
private transient String[] groupNames;
private transient Double value;
- /**
- * Set of the dynamic attributes values that belong to this
- * organisationUnit.
- */
- private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
-
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -621,8 +625,8 @@
this.url = url;
}
- @XmlElementWrapper( name = "groups" )
- @XmlElement( name = "group" )
+ @XmlElementWrapper( name = "organisationUnitGroups" )
+ @XmlElement( name = "organisationUnitGroup" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonSerialize( using = JsonIdentifiableObjectSetSerializer.class )
public Set<OrganisationUnitGroup> getGroups()
@@ -720,8 +724,6 @@
this.hasPatients = hasPatients;
}
- @XmlElement
- @JsonProperty
public int getLevel()
{
return level;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2011-12-06 17:37:30 +0000
@@ -144,8 +144,8 @@
// Getters and setters
// -------------------------------------------------------------------------
- @XmlElementWrapper( name = "members" )
- @XmlElement( name = "member" )
+ @XmlElementWrapper( name = "organisationUnits" )
+ @XmlElement( name = "organisationUnit" )
@XmlJavaTypeAdapter( BaseNameableObjectXmlAdapter.class )
@JsonSerialize( using = JsonNameableObjectSetSerializer.class )
public Set<OrganisationUnit> getMembers()
@@ -158,7 +158,7 @@
this.members = members;
}
- @XmlElement
+ @XmlElement( name = "organisationUnitGroupSet" )
@XmlJavaTypeAdapter( BaseIdentifiableObjectXmlAdapter.class )
@JsonSerialize( using = JsonIdentifiableObjectSerializer.class )
public OrganisationUnitGroupSet getGroupSet()
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-06 15:03:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2011-12-06 18:08:40 +0000
@@ -27,14 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
import javassist.util.proxy.ProxyObject;
-
-import javax.servlet.http.HttpServletRequest;
-
import org.hisp.dhis.api.webdomain.Resource;
import org.hisp.dhis.api.webdomain.Resources;
import org.hisp.dhis.attribute.Attribute;
@@ -44,36 +37,18 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseLinkableObject;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategories;
-import org.hisp.dhis.dataelement.DataElementCategory;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryCombos;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombos;
-import org.hisp.dhis.dataelement.DataElementCategoryOptions;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementGroupSets;
-import org.hisp.dhis.dataelement.DataElementGroups;
-import org.hisp.dhis.dataelement.DataElements;
+import org.hisp.dhis.dataelement.*;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSets;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorGroupSet;
-import org.hisp.dhis.indicator.IndicatorGroupSets;
-import org.hisp.dhis.indicator.IndicatorGroups;
-import org.hisp.dhis.indicator.Indicators;
+import org.hisp.dhis.indicator.*;
import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.mapping.Maps;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroups;
-import org.hisp.dhis.organisationunit.OrganisationUnits;
+import org.hisp.dhis.organisationunit.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -164,6 +139,14 @@
{
populateIndicatorGroupSets( (IndicatorGroupSets) source, true );
}
+ else if ( source instanceof IndicatorType )
+ {
+ populateIndicatorType( (IndicatorType) source, true );
+ }
+ else if ( source instanceof IndicatorTypes )
+ {
+ populateIndicatorTypes( (IndicatorTypes) source, true );
+ }
else if ( source instanceof IndicatorGroupSet )
{
populateIndicatorGroupSet( (IndicatorGroupSet) source, true );
@@ -243,13 +226,39 @@
}
- private void populateMaps( Maps maps, boolean b )
+ private void populateIndicatorTypes( IndicatorTypes indicatorTypes, boolean root )
+ {
+ indicatorTypes.setLink( getBasePath( indicatorTypes.getClass() ) );
+
+ if ( root )
+ {
+ for ( IndicatorType indicatorType : indicatorTypes.getIndicatorTypes() )
+ {
+ populateIndicatorType( indicatorType, false );
+ }
+ }
+ }
+
+ private void populateIndicatorType( IndicatorType indicatorType, boolean root )
+ {
+ populateIdentifiableObject( indicatorType );
+
+ if ( root )
+ {
+
+ }
+ }
+
+ private void populateMaps( Maps maps, boolean root )
{
maps.setLink( getBasePath( maps.getClass() ) );
- for ( MapView map : maps.getMaps() )
+ if ( root )
{
- populateMap( map, false );
+ for ( MapView map : maps.getMaps() )
+ {
+ populateMap( map, false );
+ }
}
}
@@ -391,7 +400,7 @@
}
private void populateDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo,
- boolean root )
+ boolean root )
{
dataElementCategoryOptionCombo.setLink( getPathWithUid( dataElementCategoryOptionCombo ) );
@@ -694,10 +703,11 @@
private String getBasePath( Class<?> clazz )
{
- if (ProxyObject.class.isAssignableFrom( clazz ) ) {
+ if ( ProxyObject.class.isAssignableFrom( clazz ) )
+ {
clazz = clazz.getSuperclass();
}
-
+
String resourcePath = resourcePaths.get( clazz );
// // in some cases, the class is a dynamic subclass (usually subclassed
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/list.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/list.xsl 2011-12-01 13:44:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/list.xsl 2011-12-06 17:12:25 +0000
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:d="http://dhis2.org/schema/dxf/2.0"
+ >
+
<xsl:output method="xml" />
+
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
@@ -22,11 +26,7 @@
</fo:root>
</xsl:template>
-<xsl:template match="dataElements">
- <xsl:apply-templates />
-</xsl:template>
-
-<xsl:template match="dataElement">
+<xsl:template match="d:dataElement">
<fo:block font-size="12pt" font-weight="bold" border-bottom="1pt solid black"><xsl:value-of select="@name" /></fo:block>
<fo:table border-top="1pt solid black" margin-bottom="10pt" table-layout="fixed">
<fo:table-body>
@@ -40,27 +40,27 @@
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Active</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="active" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:active" /></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>AggregationOperator</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="aggregationOperator" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:aggregationOperator" /></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>DomainType</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="domainType" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:domainType" /></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>SortOrder</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="sortOrder" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:sortOrder" /></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>Type</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="type" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:type" /></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block>ZeroIsSignificant</fo:block></fo:table-cell>
- <fo:table-cell><fo:block><xsl:value-of select="zeroIsSignificant" /></fo:block></fo:table-cell>
+ <fo:table-cell><fo:block><xsl:value-of select="d:zeroIsSignificant" /></fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/model2fop.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/model2fop.xsl 2011-12-02 14:01:09 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslfo/model2fop.xsl 2011-12-06 17:12:25 +0000
@@ -2,8 +2,6 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
- <xsl:template match="/">
- <fo>Hello World</fo>
- </xsl:template>
-
+ <xsl:include href="list.xsl"/>
+
</xsl:stylesheet>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/chart.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/chart.xsl 2011-12-06 14:07:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/chart.xsl 2011-12-06 18:27:36 +0000
@@ -6,9 +6,11 @@
<xsl:template match="d:chart">
<div class="chart">
- <h2>
- <xsl:value-of select="@name"/>
- </h2>
+ <h2>Chart: <xsl:value-of select="@name"/> </h2>
+ <a href="{@link}.png"><img src="{@link}.png" style="border-style:solid; border-width: 1px; padding: 5px;" /></a>
+
+ <h3>Details</h3>
+
<table border="1">
<tr>
<td>ID</td>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl 2011-12-06 13:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/dataElement.xsl 2011-12-06 16:05:52 +0000
@@ -67,18 +67,18 @@
</tr>
</table>
- <xsl:apply-templates select="d:categoryCombo|d:groups|d:dataSets" />
+ <xsl:apply-templates select="d:categoryCombo|d:groups|d:dataSets" mode="dataElement" />
</div>
</xsl:template>
- <xsl:template match="d:categoryCombo">
+ <xsl:template match="d:categoryCombo" mode="dataElement">
<h3>DataElementCategoryCombo</h3>
<table border="1" class="categoryCombo">
<xsl:apply-templates select="child::*" mode="row"/>
</table>
</xsl:template>
- <xsl:template match="d:groups">
+ <xsl:template match="d:groups" mode="dataElement">
<xsl:if test="count(child::*) > 0">
<h3>DataElementGroups</h3>
<table border="1" class="dataElementGroups">
@@ -87,7 +87,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="d:dataSets">
+ <xsl:template match="d:dataSets" mode="dataElement">
<xsl:if test="count(child::*) > 0">
<h3>DataSets</h3>
<table border="1" class="dataSets">
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/indicator.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/indicator.xsl 2011-12-06 14:07:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/indicator.xsl 2011-12-06 16:05:52 +0000
@@ -67,12 +67,12 @@
</table>
- <xsl:apply-templates select="d:groups|d:dataSets" />
+ <xsl:apply-templates select="d:groups|d:dataSets" mode="indicator" />
</div>
</xsl:template>
- <xsl:template match="d:groups">
+ <xsl:template match="d:groups" mode="indicator">
<xsl:if test="count(child::*) > 0">
<h3>Indicator Groups</h3>
<table border="1" class="indicatorGroups">
@@ -81,7 +81,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="d:dataSets">
+ <xsl:template match="d:dataSets" mode="indicator">
<xsl:if test="count(child::*) > 0">
<h3>DataSets</h3>
<table border="1" class="dataSets">
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-06 13:34:35 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/organisationUnit.xsl 2011-12-06 16:05:52 +0000
@@ -61,19 +61,19 @@
</table>
- <xsl:apply-templates select="d:parent|d:groups|d:dataSets" />
+ <xsl:apply-templates select="d:parent|d:groups|d:dataSets" mode="orgunit" />
</div>
</xsl:template>
- <xsl:template match="d:parent">
+ <xsl:template match="d:parent" mode="orgunit">
<h3>Parent OrganisationUnit</h3>
<table border="1">
<xsl:apply-templates select="." mode="row"/>
</table>
</xsl:template>
- <xsl:template match="d:groups">
+ <xsl:template match="d:groups" mode="orgunit">
<xsl:if test="count(child::*) > 0">
<h3>OrganisationUnit Groups</h3>
<table border="1" class="organisationUnitGroups">
@@ -82,7 +82,7 @@
</xsl:if>
</xsl:template>
- <xsl:template match="d:dataSets">
+ <xsl:template match="d:dataSets" mode="orgunit">
<xsl:if test="count(child::*) > 0">
<h3>DataSets</h3>
<table border="1" class="dataSets">