dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17786
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7212: added shortName view to api, can be used with ?viewClass=shortName with any resource view. Extend...
------------------------------------------------------------
revno: 7212
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 13:53:33 +0200
message:
added shortName view to api, can be used with ?viewClass=shortName with any resource view. Extends Basic, so uid, etc are also there. Also removed internalId and made shortName attribute in XML.
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/IdentifiableObjectView.java
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/BasicView.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/ShortNameView.java
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/BaseNameableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.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 2012-05-17 09:11:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2012-06-06 11:53:33 +0000
@@ -32,9 +32,9 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.apache.commons.lang.Validate;
+import org.hisp.dhis.common.view.BasicView;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.common.view.IdentifiableObjectView;
import java.util.Collection;
import java.util.Date;
@@ -121,9 +121,6 @@
// Setters and getters
// -------------------------------------------------------------------------
- @JsonProperty( value = "internalId" )
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
- @JacksonXmlProperty( isAttribute = true )
public int getId()
{
return id;
@@ -147,7 +144,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( {DetailedView.class, BasicView.class, ExportView.class} )
@JacksonXmlProperty( isAttribute = true )
public String getCode()
{
@@ -160,7 +157,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( {DetailedView.class, BasicView.class, ExportView.class} )
@JacksonXmlProperty( isAttribute = true )
public String getName()
{
@@ -173,7 +170,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+ @JsonView( {DetailedView.class, BasicView.class, ExportView.class} )
@JacksonXmlProperty( isAttribute = true )
public Date getLastUpdated()
{
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2012-05-28 20:41:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java 2012-06-06 11:53:33 +0000
@@ -34,6 +34,7 @@
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.view.ShortNameView;
/**
* @author Bob Jolliffe
@@ -102,8 +103,8 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
- @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ @JsonView( { ShortNameView.class, DetailedView.class, ExportView.class} )
+ @JacksonXmlProperty( isAttribute = true )
public String getShortName()
{
return shortName;
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/BasicView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/BasicView.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/BasicView.java 2012-06-06 11:53:33 +0000
@@ -0,0 +1,35 @@
+package org.hisp.dhis.common.view;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class BasicView
+{
+}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/IdentifiableObjectView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/IdentifiableObjectView.java 2012-03-12 13:27:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/IdentifiableObjectView.java 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
-package org.hisp.dhis.common.view;
-
-/*
- * Copyright (c) 2004-2012, 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.
- */
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class IdentifiableObjectView
-{
-}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/ShortNameView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/ShortNameView.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/view/ShortNameView.java 2012-06-06 11:53:33 +0000
@@ -0,0 +1,35 @@
+package org.hisp.dhis.common.view;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ShortNameView extends BasicView
+{
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java 2012-03-12 14:27:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardContent.java 2012-06-06 11:53:33 +0000
@@ -35,8 +35,8 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.view.BasicView;
import org.hisp.dhis.common.view.DetailedView;
-import org.hisp.dhis.common.view.IdentifiableObjectView;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.report.Report;
@@ -166,7 +166,7 @@
// -------------------------------------------------------------------------
@JsonProperty( value = "internalId" )
- @JsonView( {IdentifiableObjectView.class} )
+ @JsonView( {BasicView.class} )
@JacksonXmlProperty( isAttribute = true )
public int getId()
{
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java 2012-05-28 14:25:12 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java 2012-06-06 11:53:33 +0000
@@ -34,9 +34,10 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
+import org.hisp.dhis.common.view.BasicView;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.common.view.IdentifiableObjectView;
+import org.hisp.dhis.common.view.ShortNameView;
import java.io.IOException;
import java.io.InputStream;
@@ -76,8 +77,9 @@
xmlMapper.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true );
// register view classes
- viewClasses.put( "default", IdentifiableObjectView.class );
- viewClasses.put( "basic", IdentifiableObjectView.class );
+ viewClasses.put( "default", BasicView.class );
+ viewClasses.put( "basic", BasicView.class );
+ viewClasses.put( "shortName", ShortNameView.class );
viewClasses.put( "detailed", DetailedView.class );
viewClasses.put( "export", ExportView.class );
}