dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43988
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22319: minor order changes in schema descriptors
------------------------------------------------------------
revno: 22319
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 17:24:55 +0700
message:
minor order changes in schema descriptors
added:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/AnalyticalObjectObjectBundleHook.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ChartSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/DocumentSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapLayerSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapViewSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportTableSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.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-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ChartSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ChartSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ChartSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -54,7 +54,7 @@
Schema schema = new Schema( Chart.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
schema.setShareable( true );
- schema.setOrder( 1360 );
+ schema.setOrder( 2000 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_CHART_PUBLIC_ADD" ) ) );
schema.getAuthorities().add( new Authority( AuthorityType.EXTERNALIZE, Lists.newArrayList( "F_CHART_EXTERNAL" ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/DocumentSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/DocumentSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/DocumentSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -54,7 +54,7 @@
Schema schema = new Schema( Document.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
schema.setShareable( true );
- schema.setOrder( 1040 );
+ schema.setOrder( 2000 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_DOCUMENT_PUBLIC_ADD" ) ) );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PRIVATE, Lists.newArrayList( "F_DOCUMENT_PRIVATE_ADD" ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapLayerSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapLayerSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapLayerSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -50,7 +50,7 @@
{
Schema schema = new Schema( MapLayer.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
- schema.setOrder( 1090 );
+ schema.setOrder( 2000 );
return schema;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -54,7 +54,7 @@
Schema schema = new Schema( Map.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
schema.setShareable( true );
- schema.setOrder( 1420 );
+ schema.setOrder( 2000 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_MAP_PUBLIC_ADD" ) ) );
schema.getAuthorities().add( new Authority( AuthorityType.EXTERNALIZE, Lists.newArrayList( "F_MAP_EXTERNAL" ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapViewSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapViewSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/MapViewSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -50,7 +50,7 @@
{
Schema schema = new Schema( MapView.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
- schema.setOrder( 1410 );
+ schema.setOrder( 1900 );
return schema;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -54,7 +54,7 @@
Schema schema = new Schema( Report.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
schema.setShareable( true );
- schema.setOrder( 1350 );
+ schema.setOrder( 2000 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_REPORT_PUBLIC_ADD" ) ) );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PRIVATE, Lists.newArrayList( "F_REPORT_PRIVATE_ADD" ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportTableSchemaDescriptor.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportTableSchemaDescriptor.java 2016-03-10 03:41:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/descriptors/ReportTableSchemaDescriptor.java 2016-03-15 10:24:55 +0000
@@ -30,10 +30,10 @@
import com.google.common.collect.Lists;
import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.schema.Schema;
+import org.hisp.dhis.schema.SchemaDescriptor;
import org.hisp.dhis.security.Authority;
import org.hisp.dhis.security.AuthorityType;
-import org.hisp.dhis.schema.Schema;
-import org.hisp.dhis.schema.SchemaDescriptor;
import org.springframework.stereotype.Component;
/**
@@ -54,7 +54,7 @@
Schema schema = new Schema( ReportTable.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
schema.setShareable( true );
- schema.setOrder( 1340 );
+ schema.setOrder( 2000 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_REPORTTABLE_PUBLIC_ADD" ) ) );
schema.getAuthorities().add( new Authority( AuthorityType.EXTERNALIZE, Lists.newArrayList( "F_REPORTTABLE_EXTERNAL" ) ) );
=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/AnalyticalObjectObjectBundleHook.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/AnalyticalObjectObjectBundleHook.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/hooks/AnalyticalObjectObjectBundleHook.java 2016-03-15 10:24:55 +0000
@@ -0,0 +1,61 @@
+package org.hisp.dhis.dxf2.metadata2.objectbundle.hooks;
+
+/*
+ * Copyright (c) 2004-2016, 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.hisp.dhis.common.AnalyticalObject;
+import org.hisp.dhis.common.BaseAnalyticalObject;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dxf2.metadata2.objectbundle.ObjectBundle;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Order( 10 )
+@Component
+public class AnalyticalObjectObjectBundleHook
+ extends AbstractObjectBundleHook
+{
+ @Override
+ public void preCreate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
+ {
+ if ( !AnalyticalObject.class.isInstance( identifiableObject ) ) return;
+ BaseAnalyticalObject analyticalObject = (BaseAnalyticalObject) identifiableObject;
+ analyticalObject.getDataDimensionItems().clear();
+ }
+
+ @Override
+ public void preUpdate( IdentifiableObject identifiableObject, ObjectBundle objectBundle )
+ {
+ if ( !AnalyticalObject.class.isInstance( identifiableObject ) ) return;
+ BaseAnalyticalObject analyticalObject = (BaseAnalyticalObject) identifiableObject;
+ analyticalObject.getDataDimensionItems().clear();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml 2016-03-10 08:42:46 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml 2016-03-15 10:24:55 +0000
@@ -6,6 +6,8 @@
<bean class="org.hisp.dhis.dxf2.metadata2.objectbundle.hooks.IdentifiableObjectBundleHook" />
+ <bean class="org.hisp.dhis.dxf2.metadata2.objectbundle.hooks.AnalyticalObjectObjectBundleHook" />
+
<bean class="org.hisp.dhis.dxf2.metadata2.objectbundle.hooks.UserObjectBundleHook" />
<bean class="org.hisp.dhis.dxf2.metadata2.objectbundle.hooks.DataSetObjectBundleHook" />
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java 2016-03-15 08:49:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java 2016-03-15 10:24:55 +0000
@@ -39,7 +39,6 @@
import org.hisp.dhis.render.RenderFormat;
import org.hisp.dhis.render.RenderService;
import org.hisp.dhis.user.UserService;
-import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
@@ -77,7 +76,6 @@
}
@Test
- @Ignore
public void testCreateMetadataWithCharts1() throws IOException
{
Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(