dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18377
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7726: Tidied up internal routes
------------------------------------------------------------
revno: 7726
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-26 12:16:13 +0100
message:
Tidied up internal routes
modified:
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java
dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java
dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.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-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java 2012-06-29 10:51:48 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java 2012-07-26 11:16:13 +0000
@@ -29,6 +29,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.DescriptionDefinition;
+import org.apache.camel.model.RouteDefinition;
/**
* SDMXDataIn route takes an SDMX cross-sectional message, transforms to dxf2 datavalueset
@@ -43,10 +44,10 @@
public static final String SDMXDATA_IN = "direct:sdmxDataIn";
- // Route description texts
-
+ // Route description and ID
public static final String SDMXDATA_IN_DESC = "Internal: SDMX Data to DXF2 Input";
-
+ // IDs beginning with 'internal-*' do not show up in UI
+ public static final String SDMXDATA_IN_ID = "internal-sdmx-datain";
@Override
public void configure() throws Exception
@@ -54,10 +55,12 @@
DescriptionDefinition desc = new DescriptionDefinition();
desc.setText( "SDMX Data to DXF2 Input");
- from(SDMXDATA_IN).
+ RouteDefinition sdmxDataIn = from(SDMXDATA_IN).
convertBodyTo( java.lang.String.class, "UTF-8" ).to( "log:org.hisp.dhis.integration?level=INFO").
to("xslt:transform/cross2dxf2.xsl").convertBodyTo( java.io.InputStream.class).
- inOut("dhis2:data?orgUnitIdScheme=CODE&dataElementIdScheme=CODE&importStrategy=NEW_AND_UPDATES").
- setDescription( desc );
+ inOut("dhis2:data?orgUnitIdScheme=CODE&dataElementIdScheme=CODE&importStrategy=NEW_AND_UPDATES");
+
+ sdmxDataIn.setDescription( desc );
+ sdmxDataIn.setId( SDMXDATA_IN_ID );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java 2012-06-22 16:46:42 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java 2012-07-26 11:16:13 +0000
@@ -30,6 +30,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.builder.xml.Namespaces;
import org.apache.camel.model.DescriptionDefinition;
+import org.apache.camel.model.ProcessorDefinition;
/**
* XMLDataIn route implements a Content Based Routing pattern
@@ -44,9 +45,10 @@
public static final String XMLDATA_IN = "direct:xmlDataIn";
- // Route description texts
-
+ // Route description and ID
public static final String XMLDATA_IN_DESC = "Internal: XML Data to DXF2 Input";
+ // IDs beginning with 'internal-*' do not show up in UI
+ public static final String XMLDATA_IN_ID = "internal-xml-datain";
// Route definitions
@Override
@@ -59,12 +61,17 @@
DescriptionDefinition xmlDesc = new DescriptionDefinition();
xmlDesc.setText( XMLDATA_IN_DESC);
- from(XMLDATA_IN).convertBodyTo(java.lang.String.class, "UTF-8")
+ ProcessorDefinition xmlDataIn = from(XMLDATA_IN).convertBodyTo(java.lang.String.class, "UTF-8")
.choice()
+ // send native dxf2 data directly to dhis2:data
.when().xpath( "boolean(/d:dataValueSet)", ns).convertBodyTo( java.io.InputStream.class).to("dhis2:data")
+ // send sdmx data to sdmx route
.when().xpath( "boolean(/m:CrossSectionalData)", ns).to("direct:sdmxDataIn")
+ // unknown xml
.otherwise().to("log:org.hisp.dhis.integration?level=DEBUG" )
- .end()
- .setDescription( xmlDesc );
+ .end();
+
+ xmlDataIn.setDescription( xmlDesc );
+ xmlDataIn.setId( XMLDATA_IN_ID );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java'
--- dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java 2012-06-29 10:51:48 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java 2012-07-26 11:16:13 +0000
@@ -28,11 +28,8 @@
*/
import static junit.framework.Assert.assertNotNull;
-import static org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty.*;
-import static org.hisp.dhis.importexport.ImportStrategy.*;
-
-
import org.hisp.dhis.DhisTest;
+import static org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty.CODE;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -43,12 +40,12 @@
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import static org.hisp.dhis.importexport.ImportStrategy.NEW_AND_UPDATES;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
-import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;