← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15765: made Presets/Transformers pluggable using spring (using class-scanning). Added isEmpty transformer.

 

------------------------------------------------------------
revno: 15765
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-19 14:20:10 +0200
message:
  made Presets/Transformers pluggable using spring (using class-scanning). Added isEmpty transformer.
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/PropertyValueTransformer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizePropertyValueTransformer.java
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NamedProvider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/PresetProvider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeTransformer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Provider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Transformer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/AllPresetProvider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/IdentifiablePresetProvider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/NameablePresetProvider.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/IsEmptyNodeTransformer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizeNodeTransformer.java
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/FieldMap.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/resources/transforms.xml


--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NamedProvider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NamedProvider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NamedProvider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,39 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2014, 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.node.Provider;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface NamedProvider<T> extends Provider<T>
+{
+    String name();
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/PresetProvider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/PresetProvider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/PresetProvider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,38 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2014, 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 java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface PresetProvider extends NamedProvider<List<String>>
+{
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeTransformer.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeTransformer.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,36 @@
+package org.hisp.dhis.node;
+
+/*
+ * Copyright (c) 2004-2014, 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 interface NodeTransformer extends Transformer<Node>
+{
+}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/PropertyValueTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/PropertyValueTransformer.java	2014-06-19 11:25:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/PropertyValueTransformer.java	1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
-package org.hisp.dhis.node;
-
-/*
- * Copyright (c) 2004-2014, 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.schema.Property;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface PropertyValueTransformer
-{
-    /**
-     * @return Public/external name of this transformer.
-     */
-    String name();
-
-    /**
-     * Transform value. Value can be null.
-     *
-     * @param property Property instance belonging to value
-     * @param value    Actual value to transform
-     * @return Value transformed to a Node
-     */
-    Node transform( Property property, Object value );
-
-    /**
-     * Is this property/value supported by this transformer. Value can be null.
-     *
-     * @param property Property instance belonging to value
-     * @param value    Actual value to transform
-     * @return true of false depending on support
-     */
-    boolean canTransform( Property property, Object value );
-}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Provider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Provider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Provider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.node;
+
+/*
+ * Copyright (c) 2004-2014, 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 interface Provider<T>
+{
+    T provide();
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Transformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Transformer.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Transformer.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.node;
+
+/*
+ * Copyright (c) 2004-2014, 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.schema.Property;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface Transformer<T>
+{
+    /**
+     * @return Public/external name of this transformer.
+     */
+    String name();
+
+    /**
+     * Transform value. Value can be null.
+     *
+     * @param property Property instance belonging to value
+     * @param value    Actual value to transform
+     * @return Value transformed to a Node
+     */
+    T transform( Property property, Object value );
+
+    /**
+     * Is this property/value supported by this transformer. Value can be null.
+     *
+     * @param property Property instance belonging to value
+     * @param value    Actual value to transform
+     * @return true of false depending on support
+     */
+    boolean canTransform( Property property, Object value );
+}

=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/AllPresetProvider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/AllPresetProvider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/AllPresetProvider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,54 @@
+package org.hisp.dhis.node.presets;
+
+/*
+ * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
+import org.hisp.dhis.common.PresetProvider;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class AllPresetProvider implements PresetProvider
+{
+    @Override
+    public String name()
+    {
+        return "all";
+    }
+
+    @Override
+    public List<String> provide()
+    {
+        return Lists.newArrayList( "*" );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/IdentifiablePresetProvider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/IdentifiablePresetProvider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/IdentifiablePresetProvider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,54 @@
+package org.hisp.dhis.node.presets;
+
+/*
+ * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
+import org.hisp.dhis.common.PresetProvider;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class IdentifiablePresetProvider implements PresetProvider
+{
+    @Override
+    public String name()
+    {
+        return "identifiable";
+    }
+
+    @Override
+    public List<String> provide()
+    {
+        return Lists.newArrayList( "id", "name", "code", "created", "lastUpdated", "href" );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/NameablePresetProvider.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/NameablePresetProvider.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/presets/NameablePresetProvider.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,54 @@
+package org.hisp.dhis.node.presets;
+
+/*
+ * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
+import org.hisp.dhis.common.PresetProvider;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class NameablePresetProvider implements PresetProvider
+{
+    @Override
+    public String name()
+    {
+        return "nameable";
+    }
+
+    @Override
+    public List<String> provide()
+    {
+        return Lists.newArrayList( "id", "name", "shortName", "description", "code", "created", "lastUpdated", "href" );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/IsEmptyNodeTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/IsEmptyNodeTransformer.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/IsEmptyNodeTransformer.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,67 @@
+package org.hisp.dhis.node.transformers;
+
+/*
+ * Copyright (c) 2004-2014, 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.node.Node;
+import org.hisp.dhis.node.NodeTransformer;
+import org.hisp.dhis.node.types.SimpleNode;
+import org.hisp.dhis.schema.Property;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class IsEmptyNodeTransformer implements NodeTransformer
+{
+    @Override
+    public String name()
+    {
+        return "isEmpty";
+    }
+
+    @Override
+    public Node transform( Property property, Object value )
+    {
+        if ( property.isCollection() )
+        {
+            return new SimpleNode( property.getCollectionName(), ((Collection<?>) value).isEmpty(), property.isAttribute() );
+        }
+
+        throw new IllegalStateException( "Should never get here, this property/value is not supported by this transformer." );
+    }
+
+    @Override
+    public boolean canTransform( Property property, Object value )
+    {
+        return property.isCollection();
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizeNodeTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizeNodeTransformer.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizeNodeTransformer.java	2014-06-19 12:20:10 +0000
@@ -0,0 +1,71 @@
+package org.hisp.dhis.node.transformers;
+
+/*
+ * Copyright (c) 2004-2014, 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.node.Node;
+import org.hisp.dhis.node.NodeTransformer;
+import org.hisp.dhis.node.types.SimpleNode;
+import org.hisp.dhis.schema.Property;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class SizeNodeTransformer implements NodeTransformer
+{
+    @Override
+    public String name()
+    {
+        return "size";
+    }
+
+    @Override
+    public Node transform( Property property, Object value )
+    {
+        if ( property.isCollection() )
+        {
+            return new SimpleNode( property.getCollectionName(), ((Collection<?>) value).size(), property.isAttribute() );
+        }
+        else if ( String.class.isInstance( value ) )
+        {
+            return new SimpleNode( property.getName(), ((String) value).length(), property.isAttribute() );
+        }
+
+        throw new IllegalStateException( "Should never get here, this property/value is not supported by this transformer." );
+    }
+
+    @Override
+    public boolean canTransform( Property property, Object value )
+    {
+        return property.isCollection() || String.class.isInstance( value );
+    }
+}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizePropertyValueTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizePropertyValueTransformer.java	2014-06-19 11:25:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/transformers/SizePropertyValueTransformer.java	1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-package org.hisp.dhis.node.transformers;
-
-/*
- * Copyright (c) 2004-2014, 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.node.Node;
-import org.hisp.dhis.node.PropertyValueTransformer;
-import org.hisp.dhis.node.types.SimpleNode;
-import org.hisp.dhis.schema.Property;
-
-import java.util.Collection;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class SizePropertyValueTransformer implements PropertyValueTransformer
-{
-    @Override
-    public String name()
-    {
-        return "size";
-    }
-
-    @Override
-    public Node transform( Property property, Object value )
-    {
-        if ( property.isCollection() )
-        {
-            return new SimpleNode( property.getCollectionName(), ((Collection<?>) value).size(), property.isAttribute() );
-        }
-        else if ( String.class.isInstance( value ) )
-        {
-            return new SimpleNode( property.getName(), ((String) value).length(), property.isAttribute() );
-        }
-
-        throw new IllegalStateException( "Should never get here, this property/value is not supported by this transformer." );
-    }
-
-    @Override
-    public boolean canTransform( Property property, Object value )
-    {
-        return property.isCollection() || String.class.isInstance( value );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java	2014-06-19 11:38:58 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/DefaultFieldFilterService.java	2014-06-19 12:20:10 +0000
@@ -33,7 +33,8 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.node.transformers.SizePropertyValueTransformer;
+import org.hisp.dhis.node.NodeTransformer;
+import org.hisp.dhis.common.PresetProvider;
 import org.hisp.dhis.node.types.CollectionNode;
 import org.hisp.dhis.node.types.ComplexNode;
 import org.hisp.dhis.node.types.SimpleNode;
@@ -43,26 +44,54 @@
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.annotation.PostConstruct;
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public class DefaultFieldFilterService implements FieldFilterService
 {
-    static final ImmutableMap<String, List<String>> FIELD_PRESETS = ImmutableMap.<String, List<String>>builder()
-        .put( "all", Lists.newArrayList( "*" ) )
-        .put( "identifiable", Lists.newArrayList( "id", "name", "code", "created", "lastUpdated", "href" ) )
-        .put( "nameable", Lists.newArrayList( "id", "name", "shortName", "description", "code", "created", "lastUpdated", "href" ) )
-        .build();
-
     @Autowired
     private ParserService parserService;
 
     @Autowired
     private SchemaService schemaService;
 
+    @Autowired( required = false )
+    private Set<PresetProvider> presetProviders = Sets.newHashSet();
+
+    @Autowired( required = false )
+    private Set<NodeTransformer> nodeTransformers = Sets.newHashSet();
+
+    private ImmutableMap<String, PresetProvider> presets;
+
+    private ImmutableMap<String, NodeTransformer> transformers;
+
+    @PostConstruct
+    public void init()
+    {
+        ImmutableMap.Builder<String, PresetProvider> presetProviderBuilder = ImmutableMap.builder();
+
+        for ( PresetProvider presetProvider : presetProviders )
+        {
+            presetProviderBuilder.put( presetProvider.name(), presetProvider );
+        }
+
+        presets = presetProviderBuilder.build();
+
+        ImmutableMap.Builder<String, NodeTransformer> transformerBuilder = ImmutableMap.builder();
+
+        for ( NodeTransformer transformer : nodeTransformers )
+        {
+            transformerBuilder.put( transformer.name(), transformer );
+        }
+
+        transformers = transformerBuilder.build();
+    }
+
     @Override
     public <T extends IdentifiableObject> CollectionNode filter( Class<?> klass, List<T> objects, List<String> fieldList )
     {
@@ -139,11 +168,11 @@
                 updateFields( fieldValue, property.getKlass() );
             }
 
-            if ( fieldValue.isTransform() )
+            if ( fieldValue.haveNodeTransformer() )
             {
-                SizePropertyValueTransformer transformer = new SizePropertyValueTransformer();
+                NodeTransformer transformer = fieldValue.getNodeTransformer();
 
-                if ( transformer.canTransform( property, returnValue ) )
+                if ( transformer != null && transformer.canTransform( property, returnValue ) )
                 {
                     complexNode.addChild( transformer.transform( property, returnValue ) );
                 }
@@ -151,7 +180,7 @@
             }
             else if ( fieldValue.isEmpty() )
             {
-                List<String> fields = FIELD_PRESETS.get( "identifiable" );
+                List<String> fields = presets.get( "identifiable" ).provide();
 
                 if ( property.isCollection() )
                 {
@@ -270,13 +299,15 @@
             }
             else if ( fieldKey.startsWith( ":" ) )
             {
-                List<String> fields = FIELD_PRESETS.get( fieldKey.substring( 1 ) );
+                PresetProvider presetProvider = presets.get( fieldKey.substring( 1 ) );
 
-                if ( fields == null )
+                if ( presetProvider == null )
                 {
                     continue;
                 }
 
+                List<String> fields = presetProvider.provide();
+
                 for ( String field : fields )
                 {
                     if ( !fieldMap.containsKey( field ) )
@@ -298,8 +329,12 @@
                 if ( split.length == 2 )
                 {
                     FieldMap value = new FieldMap();
-                    value.setTransform( split[1] );
-                    fieldMap.put( split[0], value );
+
+                    if ( transformers.containsKey( split[1] ) )
+                    {
+                        value.setNodeTransformer( transformers.get( split[1] ) );
+                        fieldMap.put( split[0], value );
+                    }
                 }
 
                 cleanupFields.add( fieldKey );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/FieldMap.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/FieldMap.java	2014-06-19 11:25:24 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/filter/FieldMap.java	2014-06-19 12:20:10 +0000
@@ -31,7 +31,7 @@
 import com.google.common.base.Objects;
 import com.google.common.collect.ForwardingMap;
 import com.google.common.collect.Maps;
-import org.springframework.util.StringUtils;
+import org.hisp.dhis.node.NodeTransformer;
 
 import java.util.Map;
 
@@ -42,9 +42,7 @@
 {
     private final Map<String, FieldMap> delegate = Maps.newHashMap();
 
-    private String transform;
-
-    private String preset;
+    private NodeTransformer nodeTransformer;
 
     @Override
     protected Map<String, FieldMap> delegate()
@@ -52,19 +50,19 @@
         return delegate;
     }
 
-    public String getTransform()
-    {
-        return transform;
-    }
-
-    public void setTransform( String transform )
-    {
-        this.transform = transform;
-    }
-
-    public boolean isTransform()
-    {
-        return !StringUtils.isEmpty( transform );
+    public NodeTransformer getNodeTransformer()
+    {
+        return nodeTransformer;
+    }
+
+    public void setNodeTransformer( NodeTransformer nodeTransformer )
+    {
+        this.nodeTransformer = nodeTransformer;
+    }
+
+    public boolean haveNodeTransformer()
+    {
+        return nodeTransformer != null;
     }
 
     @Override
@@ -72,7 +70,7 @@
     {
         return Objects.toStringHelper( this )
             .add( "map", standardToString() )
-            .add( "transform", transform )
+            .add( "nodeTransformer", nodeTransformer )
             .toString();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/resources/transforms.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/resources/transforms.xml	2010-07-02 12:53:57 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/resources/transforms.xml	2014-06-19 12:20:10 +0000
@@ -2,7 +2,7 @@
 <transforms>
     <transform tag="change">
         <xslt>changeroot.xsl</xslt>
-        <description>Simple test transformer</description>
+        <description>Simple test nodeTransformer</description>
     </transform>
     <transform tag="excel_0.1alpha">
         <xslt>xl2dxf.xsl</xslt>