← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4540: UI for adding/updating/removing dynamic attributes (work in progress..)

 

------------------------------------------------------------
revno: 4540
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-07 15:42:12 +0200
message:
  UI for adding/updating/removing dynamic attributes (work in progress..)
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeNameComparator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeOptionNameComparator.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeOptionForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attributeOption.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttribute.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttributeOption.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeOptionForm.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/AttributeOption.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/ValidateConstantAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm


--
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/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2011-09-07 13:42:12 +0000
@@ -57,6 +57,17 @@
 
     private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
 
+    public Attribute()
+    {
+
+    }
+
+    public Attribute( String name, String valueType )
+    {
+        this.name = name;
+        this.valueType = valueType;
+    }
+
     public String getValueType()
     {
         return valueType;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOption.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOption.java	2011-09-07 13:42:12 +0000
@@ -27,25 +27,22 @@
 
 package org.hisp.dhis.attribute;
 
-import java.io.Serializable;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.hisp.dhis.common.AbstractIdentifiableObject;
+
 /**
  * @author mortenoh
  */
 public class AttributeOption
-    implements Serializable
+    extends AbstractIdentifiableObject
 {
     /**
      * Determines if a de-serialized file is compatible with this class.
      */
     private static final long serialVersionUID = -2698940415255819380L;
 
-    private int id;
-
-    private String value;
-
     private Set<Attribute> attributes = new HashSet<Attribute>();
 
     public AttributeOption()
@@ -53,29 +50,9 @@
 
     }
 
-    public AttributeOption( String value )
-    {
-        this.value = value;
-    }
-
-    public int getId()
-    {
-        return id;
-    }
-
-    public void setId( int id )
-    {
-        this.id = id;
-    }
-
-    public String getValue()
-    {
-        return value;
-    }
-
-    public void setValue( String value )
-    {
-        this.value = value;
+    public AttributeOption( String name )
+    {
+        this.name = name;
     }
 
     public Set<Attribute> getAttributes()
@@ -87,4 +64,4 @@
     {
         this.attributes = attributes;
     }
- }
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionStore.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionStore.java	2011-09-07 13:42:12 +0000
@@ -27,13 +27,13 @@
 
 package org.hisp.dhis.attribute;
 
-import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 
 /**
  * @author mortenoh
  */
 public interface AttributeOptionStore
-    extends GenericStore<AttributeOption>
+    extends GenericIdentifiableObjectStore<AttributeOption>
 {
     String ID = AttributeOptionStore.class.getName();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-07 08:03:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-07 13:42:12 +0000
@@ -36,6 +36,10 @@
 {
     String ID = AttributeService.class.getName();
 
+    // -------------------------------------------------------------------------
+    // Attribute
+    // -------------------------------------------------------------------------
+
     public void addAttribute( Attribute attribute );
 
     public void updateAttribute( Attribute attribute );
@@ -44,8 +48,22 @@
 
     public Attribute getAttribute( int id );
 
+    public Attribute getAttributeByName( String name );
+
     public Set<Attribute> getAllAttributes();
 
+    public int getAttributeCount();
+
+    public int getAttributeCountByName( String name );
+
+    public Set<Attribute> getAttributesBetween( int first, int max );
+
+    public Set<Attribute> getAttributesBetweenByName( String name, int first, int max );
+
+    // -------------------------------------------------------------------------
+    // AttributeOption
+    // -------------------------------------------------------------------------
+
     public void addAttributeOption( AttributeOption attributeOption );
 
     public void updateAttributeOption( AttributeOption attributeOption );
@@ -54,8 +72,22 @@
 
     public AttributeOption getAttributeOption( int id );
 
+    public AttributeOption getAttributeOptionByName( String name );
+
     public Set<AttributeOption> getAllAttributeOptions();
 
+    public int getAttributeOptionCount();
+
+    public int getAttributeOptionCountByName( String name );
+
+    public Set<AttributeOption> getAttributeOptionsBetween( int first, int max );
+
+    public Set<AttributeOption> getAttributeOptionsBetweenByName( String name, int first, int max );
+
+    // -------------------------------------------------------------------------
+    // AttributeValue
+    // -------------------------------------------------------------------------
+
     public void addAttributeValue( AttributeValue attributeValue );
 
     public void updateAttributeValue( AttributeValue attributeValue );
@@ -65,4 +97,6 @@
     public AttributeValue getAttributeValue( int id );
 
     public Set<AttributeValue> getAllAttributeValues();
+
+    public int getAttributeValueCount();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2011-09-07 13:42:12 +0000
@@ -29,13 +29,13 @@
 
 import java.util.Set;
 
-import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 
 /**
  * @author mortenoh
  */
 public interface AttributeStore
-    extends GenericStore<Attribute>
+    extends GenericIdentifiableObjectStore<Attribute>
 {
     String ID = AttributeStore.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java	2011-09-07 13:42:12 +0000
@@ -36,4 +36,6 @@
     extends GenericStore<AttributeValue>
 {
     String ID = AttributeValueStore.class.getName();
+    
+    int getCount();
 }

=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeNameComparator.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+package org.hisp.dhis.attribute.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.attribute.Attribute;
+
+public class AttributeNameComparator
+    implements Comparator<Attribute>
+{
+    @Override
+    public int compare( Attribute a0, Attribute a1 )
+    {
+        return a0.getName().compareToIgnoreCase( a1.getName() );
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeOptionNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeOptionNameComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeOptionNameComparator.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+package org.hisp.dhis.attribute.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.attribute.AttributeOption;
+
+public class AttributeOptionNameComparator
+    implements Comparator<AttributeOption>
+{
+    @Override
+    public int compare( AttributeOption ao0, AttributeOption ao1 )
+    {
+        return ao0.getName().compareToIgnoreCase( ao1.getName() );
+    }
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java	2011-01-06 13:33:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java	2011-09-07 13:42:12 +0000
@@ -42,14 +42,14 @@
      * @return the generated identifier.
      */
     int save( T object );
-    
+
     /**
      * Updates the given object instance.
      * 
      * @param object the object instance.
      */
     void update( T object );
-    
+
     /**
      * Saves or updates the given object instance depending on the object's
      * persistent state.
@@ -57,7 +57,7 @@
      * @param object the object instance.
      */
     void saveOrUpdate( T object );
-    
+
     /**
      * Retrieves the object with the given identifier. This method will first
      * look in the current Session, then hit the database if not existing.
@@ -66,30 +66,31 @@
      * @return the object identified by the given identifier.
      */
     T get( int id );
-    
+
     /**
      * Retrieves the object with the given identifier, assuming it exists.
      * 
      * @param id the object identifier.
-     * @return the object identified by the given identifier or a generated proxy.
+     * @return the object identified by the given identifier or a generated
+     *         proxy.
      */
     T load( int id );
-    
+
     /**
-     * Retriveves a Collection of objects where the name is like the given name.
+     * Retrieves a Collection of objects where the name is like the given name.
      * 
-     * @param name hte name.
+     * @param name the name.
      * @return a Collection of objects.
      */
     Collection<T> getLikeName( String name );
-    
+
     /**
      * Retrieves a Collection of all objects.
      * 
      * @return a Collection of all objects.
      */
     Collection<T> getAll();
-    
+
     /**
      * Removes the given object instance.
      * 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-07 08:03:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-07 13:42:12 +0000
@@ -104,15 +104,45 @@
     }
 
     @Override
+    public Attribute getAttributeByName( String name )
+    {
+        return attributeStore.getByName( name );
+    }
+    
+    @Override
     public Set<Attribute> getAllAttributes()
     {
         return new HashSet<Attribute>( attributeStore.getAll() );
     }
 
+    @Override
+    public int getAttributeCount()
+    {
+        return attributeStore.getCount();
+    }
+
+    @Override
+    public int getAttributeCountByName( String name )
+    {
+        return attributeStore.getCountByName( name );
+    }
+
+    @Override
+    public Set<Attribute> getAttributesBetween( int first, int max )
+    {
+        return new HashSet<Attribute>( attributeStore.getBetween( first, max ) );
+    }
+
+    @Override
+    public Set<Attribute> getAttributesBetweenByName( String name, int first, int max )
+    {
+        return new HashSet<Attribute>( attributeStore.getBetweenByName( name, first, max ) );
+    }
+
     // -------------------------------------------------------------------------
     // AttributeOption implementation
     // -------------------------------------------------------------------------
-    
+
     @Override
     public void addAttributeOption( AttributeOption attributeOption )
     {
@@ -138,15 +168,45 @@
     }
 
     @Override
+    public AttributeOption getAttributeOptionByName( String name )
+    {
+        return attributeOptionStore.getByName( name );
+    }
+
+    @Override
     public Set<AttributeOption> getAllAttributeOptions()
     {
         return new HashSet<AttributeOption>( attributeOptionStore.getAll() );
     }
 
+    @Override
+    public int getAttributeOptionCount()
+    {
+        return attributeOptionStore.getCount();
+    }
+
+    @Override
+    public int getAttributeOptionCountByName( String name )
+    {
+        return attributeOptionStore.getCountByName( name );
+    }
+
+    @Override
+    public Set<AttributeOption> getAttributeOptionsBetween( int first, int max )
+    {
+        return new HashSet<AttributeOption>( attributeOptionStore.getBetween( first, max ) );
+    }
+
+    @Override
+    public Set<AttributeOption> getAttributeOptionsBetweenByName( String name, int first, int max )
+    {
+        return new HashSet<AttributeOption>( attributeOptionStore.getBetweenByName( name, first, max ) );
+    }
+
     // -------------------------------------------------------------------------
     // AttributeValue implementation
     // -------------------------------------------------------------------------
-    
+
     @Override
     public void addAttributeValue( AttributeValue attributeValue )
     {
@@ -177,4 +237,9 @@
         return new HashSet<AttributeValue>( attributeValueStore.getAll() );
     }
 
+    @Override
+    public int getAttributeValueCount()
+    {
+        return attributeValueStore.getCount();
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/AttributeOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/AttributeOption.hbm.xml	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/AttributeOption.hbm.xml	2011-09-07 13:42:12 +0000
@@ -12,7 +12,7 @@
       <generator class="native" />
     </id>
 
-    <property name="value" />
+    <property name="name" not-null="true" unique="true" />
 
     <set name="attributes" table="attributeattributeoptions">
       <cache usage="read-write" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java	2011-09-07 08:03:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java	2011-09-07 13:42:12 +0000
@@ -67,8 +67,8 @@
         attributeService.addAttributeOption( attributeOption1 );
         attributeService.addAttributeOption( attributeOption2 );
 
-        attributeOption1.setValue( "updated option 1" );
-        attributeOption2.setValue( "updated option 2" );
+        attributeOption1.setName( "updated option 1" );
+        attributeOption2.setName( "updated option 2" );
 
         attributeService.updateAttributeOption( attributeOption1 );
         attributeService.updateAttributeOption( attributeOption2 );
@@ -79,8 +79,8 @@
         assertNotNull( attributeOption1 );
         assertNotNull( attributeOption2 );
 
-        assertEquals( "updated option 1", attributeOption1.getValue() );
-        assertEquals( "updated option 2", attributeOption2.getValue() );
+        assertEquals( "updated option 1", attributeOption1.getName() );
+        assertEquals( "updated option 2", attributeOption2.getName() );
     }
 
     @Test

=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private String valueType;
+
+    public void setValueType( String valueType )
+    {
+        this.valueType = valueType;
+    }
+
+    private Boolean mandatory = false;
+
+    public void setMandatory( Boolean mandatory )
+    {
+        this.mandatory = mandatory;
+    }
+
+    private Boolean dataElement = false;
+
+    public void setDataElement( Boolean dataElement )
+    {
+        this.dataElement = dataElement;
+    }
+
+    private Boolean indicator = false;
+
+    public void setIndicator( Boolean indicator )
+    {
+        this.indicator = indicator;
+    }
+
+    private Boolean organisationUnit = false;
+
+    public void setOrganisationUnit( Boolean organisationUnit )
+    {
+        this.organisationUnit = organisationUnit;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        Attribute attribute = new Attribute( name, valueType );
+        attribute.setMandatory( mandatory );
+        attribute.setDataElement( dataElement );
+        attribute.setIndicator( indicator );
+        attribute.setOrganisationUnit( organisationUnit );
+
+        attributeService.addAttribute( attribute );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeOptionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeOptionAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeOption;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddAttributeOptionAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        AttributeOption attributeOption = new AttributeOption( name );
+
+        attributeService.addAttributeOption( attributeOption );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Attribute attribute;
+
+    public Attribute getAttribute()
+    {
+        return attribute;
+    }
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        attribute = attributeService.getAttribute( id );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author mortenoh
+ */
+public class GetAttributeListAction
+    extends ActionPagingSupport<Attribute>
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private List<Attribute> attributes;
+
+    public List<Attribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    private String key;
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        if ( isNotBlank( key ) )
+        {
+            this.paging = createPaging( attributeService.getAttributeCountByName( key ) );
+
+            attributes = new ArrayList<Attribute>( attributeService.getAttributesBetweenByName( key,
+                paging.getStartPos(), paging.getPageSize() ) );
+        }
+        else
+        {
+            this.paging = createPaging( attributeService.getAttributeOptionCount() );
+
+            attributes = new ArrayList<Attribute>( attributeService.getAttributesBetween( paging.getStartPos(),
+                paging.getPageSize() ) );
+        }
+
+        Collections.sort( attributes, new AttributeNameComparator() );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeOption;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetAttributeOptionAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private AttributeOption attributeOption;
+
+    public AttributeOption getAttributeOption()
+    {
+        return attributeOption;
+    }
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        attributeOption = attributeService.getAttributeOption( id );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionListAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeOptionListAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.attribute.AttributeOption;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeOptionNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author mortenoh
+ */
+public class GetAttributeOptionListAction
+    extends ActionPagingSupport<AttributeOption>
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private List<AttributeOption> attributeOptions;
+
+    public List<AttributeOption> getAttributeOptions()
+    {
+        return attributeOptions;
+    }
+
+    private String key;
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        if ( isNotBlank( key ) )
+        {
+            this.paging = createPaging( attributeService.getAttributeOptionCountByName( key ) );
+
+            attributeOptions = new ArrayList<AttributeOption>( attributeService.getAttributeOptionsBetweenByName( key,
+                paging.getStartPos(), paging.getPageSize() ) );
+        }
+        else
+        {
+            this.paging = createPaging( attributeService.getAttributeOptionCount() );
+
+            attributeOptions = new ArrayList<AttributeOption>( attributeService.getAttributeOptionsBetween(
+                paging.getStartPos(), paging.getPageSize() ) );
+        }
+
+        Collections.sort( attributeOptions, new AttributeOptionNameComparator() );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        try
+        {
+            attributeService.deleteAttribute( attributeService.getAttribute( id ) );
+        }
+        catch ( DeleteNotAllowedException ex )
+        {
+            if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+            {
+                message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+
+                return ERROR;
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveAttributeOptionAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        try
+        {
+            attributeService.deleteAttributeOption( attributeService.getAttributeOption( id ) );
+        }
+        catch ( DeleteNotAllowedException ex )
+        {
+            if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+            {
+                message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+
+                return ERROR;
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        Attribute attribute = attributeService.getAttribute( id );
+
+        if ( attribute != null )
+        {
+            attribute.setName( name );
+
+            attributeService.updateAttribute( attribute );
+
+            return SUCCESS;
+        }
+
+        return ERROR;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeOptionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeOptionAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeOption;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateAttributeOptionAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        AttributeOption attributeOption = attributeService.getAttributeOption( id );
+
+        if ( attributeOption != null )
+        {
+            attributeOption.setName( name );
+
+            attributeService.updateAttributeOption( attributeOption );
+
+            return SUCCESS;
+        }
+
+        return ERROR;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class ValidateAttributeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        if ( name != null )
+        {
+            Attribute match = attributeService.getAttributeByName( name );
+
+            if ( match != null && (id == null || match.getId() != id) )
+            {
+                message = i18n.getString( "name_in_use" );
+
+                return ERROR;
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeOptionAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/ValidateAttributeOptionAction.java	2011-09-07 13:42:12 +0000
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import org.hisp.dhis.attribute.AttributeOption;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class ValidateAttributeOptionAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+    {
+        if ( name != null )
+        {
+            AttributeOption match = attributeService.getAttributeOptionByName( name );
+
+            if ( match != null && (id == null || match.getId() != id) )
+            {
+                message = i18n.getString( "name_in_use" );
+
+                return ERROR;
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/ValidateConstantAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/ValidateConstantAction.java	2011-07-01 04:50:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/ValidateConstantAction.java	2011-09-07 13:42:12 +0000
@@ -102,7 +102,7 @@
 
             if ( match != null && (id == null || match.getId() != id) )
             {
-                message = i18n.getString( "name_in_used" );
+                message = i18n.getString( "name_in_use" );
 
                 return ERROR;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2011-09-04 10:21:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2011-09-07 13:42:12 +0000
@@ -3,7 +3,7 @@
   xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd";>
 
-	<!-- Locking -->
+  <!-- Locking -->
 
   <bean id="org.hisp.dhis.dataadmin.action.lock.GetPeriodTypesAction" class="org.hisp.dhis.dataadmin.action.lock.GetPeriodTypesAction"
     scope="prototype">
@@ -36,7 +36,7 @@
     <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
   </bean>
 
-	<!-- Maintenance -->
+  <!-- Maintenance -->
 
   <bean id="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction" class="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction"
     scope="prototype">
@@ -46,7 +46,7 @@
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
   </bean>
 
-	<!-- Resource table -->
+  <!-- Resource table -->
 
   <bean id="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction" class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction"
     scope="prototype">
@@ -54,7 +54,7 @@
     <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
   </bean>
 
-	<!-- Cache -->
+  <!-- Cache -->
 
   <bean id="org.hisp.dhis.dataadmin.action.cache.ShowCacheAction" class="org.hisp.dhis.dataadmin.action.cache.ShowCacheAction"
     scope="prototype">
@@ -66,19 +66,19 @@
     <property name="cacheManager" ref="cacheManager" />
   </bean>
 
-	<!-- Data integrity -->
+  <!-- Data integrity -->
 
   <bean id="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction" class="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction"
     scope="prototype">
     <property name="dataIntegrityService" ref="org.hisp.dhis.dataintegrity.DataIntegrityService" />
   </bean>
 
-	<!-- Statistics -->
+  <!-- Statistics -->
 
   <bean id="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsAction" class="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsAction"
     scope="prototype">
     <property name="statisticsProvider" ref="org.hisp.dhis.statistics.StatisticsProvider" />
-	<property name="userService" ref="org.hisp.dhis.user.UserService" />
+    <property name="userService" ref="org.hisp.dhis.user.UserService" />
   </bean>
 
   <bean id="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsChartAction" class="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsChartAction"
@@ -87,7 +87,7 @@
     <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
   </bean>
 
-	<!-- Databrowser Grid -->
+  <!-- Databrowser Grid -->
 
   <bean id="org.hisp.dhis.dataadmin.action.databrowser.DataBrowserAction" class="org.hisp.dhis.dataadmin.action.databrowser.DataBrowserAction"
     scope="prototype">
@@ -107,8 +107,8 @@
 
   <bean id="org.hisp.dhis.dataadmin.action.databrowser.ExportResultAction" class="org.hisp.dhis.dataadmin.action.databrowser.ExportResultAction"
     scope="prototype" />
-	
-	<!-- Organisation unit merge -->
+
+  <!-- Organisation unit merge -->
 
   <bean id="org.hisp.dhis.dataadmin.action.organisationunitmerge.MergeOrganisationUnitsAction" class="org.hisp.dhis.dataadmin.action.organisationunitmerge.MergeOrganisationUnitsAction"
     scope="prototype">
@@ -116,7 +116,7 @@
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
-	<!-- Prune Organisation unit -->
+  <!-- Prune Organisation unit -->
 
   <bean id="org.hisp.dhis.dataadmin.action.dataprune.PruneOrganisationUnitAction" class="org.hisp.dhis.dataadmin.action.dataprune.PruneOrganisationUnitAction"
     scope="prototype">
@@ -124,7 +124,7 @@
     <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
   </bean>
 
-	<!-- Duplicate data elimination -->
+  <!-- Duplicate data elimination -->
 
   <bean id="org.hisp.dhis.dataadmin.action.duplicatedataelimination.EliminateDuplicateDataAction" class="org.hisp.dhis.dataadmin.action.duplicatedataelimination.EliminateDuplicateDataAction"
     scope="prototype">
@@ -133,7 +133,7 @@
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
   </bean>
 
-	<!--  Data Element Zero Value Storage Management -->
+  <!-- Data Element Zero Value Storage Management -->
   <bean id="org.hisp.dhis.dataadmin.action.zerovaluestorage.OpenDataElementsZeroIsSignificantManagerAction" class="org.hisp.dhis.dataadmin.action.zerovaluestorage.OpenDataElementsZeroIsSignificantManagerAction"
     scope="prototype">
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
@@ -144,7 +144,7 @@
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
   </bean>
 
-	<!-- Data archive -->
+  <!-- Data archive -->
 
   <bean id="org.hisp.dhis.dataadmin.action.dataarchive.ArchiveDataAction" class="org.hisp.dhis.dataadmin.action.dataarchive.ArchiveDataAction"
     scope="prototype">
@@ -166,7 +166,7 @@
     <property name="dataArchiveService" ref="org.hisp.dhis.dataarchive.DataArchiveService" />
   </bean>
 
-	<!-- Min/Max validation -->
+  <!-- Min/Max validation -->
 
   <bean id="org.hisp.dhis.dataadmin.action.minmaxvalidation.GetMinMaxValidationParamsAction" class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GetMinMaxValidationParamsAction"
     scope="prototype">
@@ -200,8 +200,8 @@
       <ref bean="org.hisp.dhis.options.SystemSettingManager" />
     </property>
   </bean>
-	
-	<!-- Sql View -->
+
+  <!-- Sql View -->
 
   <bean id="org.hisp.dhis.dataadmin.action.sqlview.GetSqlViewObjectAction" class="org.hisp.dhis.dataadmin.action.sqlview.GetSqlViewObjectAction"
     scope="prototype">
@@ -247,43 +247,99 @@
     scope="prototype">
     <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
   </bean>
-  
-  	<!-- Constant Name -->
-
-  <bean id="org.hisp.dhis.dataadmin.action.constant.AddConstantAction" 
-	class="org.hisp.dhis.dataadmin.action.constant.AddConstantAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.constant.UpdateConstantAction"
-	class="org.hisp.dhis.dataadmin.action.constant.UpdateConstantAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.constant.ValidateConstantAction"
-	class="org.hisp.dhis.dataadmin.action.constant.ValidateConstantAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-  </bean>
-  
-  <bean id="org.hisp.dhis.dataadmin.action.constant.RemoveConstantAction"
-	class="org.hisp.dhis.dataadmin.action.constant.RemoveConstantAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.constant.GetConstantAction"
-	class="org.hisp.dhis.dataadmin.action.constant.GetConstantAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dataadmin.action.constant.GetConstantListAction"
-	class="org.hisp.dhis.dataadmin.action.constant.GetConstantListAction"
-    scope="prototype">
-    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+
+  <!-- Constant Name -->
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.AddConstantAction" class="org.hisp.dhis.dataadmin.action.constant.AddConstantAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.UpdateConstantAction" class="org.hisp.dhis.dataadmin.action.constant.UpdateConstantAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.ValidateConstantAction" class="org.hisp.dhis.dataadmin.action.constant.ValidateConstantAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.RemoveConstantAction" class="org.hisp.dhis.dataadmin.action.constant.RemoveConstantAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.GetConstantAction" class="org.hisp.dhis.dataadmin.action.constant.GetConstantAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.constant.GetConstantListAction" class="org.hisp.dhis.dataadmin.action.constant.GetConstantListAction"
+    scope="prototype">
+    <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+  </bean>
+
+  <!-- Dynamic Attributes -->
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionListAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionListAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeOptionAction" class="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeOptionAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.AddAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.AddAttributeAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.AddAttributeOptionAction" class="org.hisp.dhis.dataadmin.action.attribute.AddAttributeOptionAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeOptionAction" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeOptionAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+  </bean>
+
+  <bean id="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeOptionAction" class="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeOptionAction"
+    scope="prototype">
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
   </bean>
 
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2011-09-04 10:21:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2011-09-07 13:42:12 +0000
@@ -122,6 +122,8 @@
 intro_duplicate_data_elimination									= Eliminate data registered for duplicate data elements. Useful when data has been entered for identical data elements.
 intro_sql_view														= Create SQL database views. These views will typically use the resource tables to provide convenient views for third-party tools.
 intro_constant														= Create the Constant which would be included in expression of indicator/validation rule.
+intro_attribute														= Create and update dynamic attributes.
+intro_attribute_option												= Create and update dynamic attribute options.
 expression_is_empty 												= Expression is empty
 dataelement_id_not_numeric 											= Data element identifier must be a number
 category_option_combo_id_not_numeric		    					= Category option combo identifier must be a number
@@ -219,7 +221,7 @@
 add_new_sql_view                                                    = Add new Sql view
 update_sql_view                                                     = Update Sql view
 name_is_null                                                        = Name is not allowed to be null
-name_in_used                                                        = Name is in use
+name_in_use															= Name is in use
 sqlquery_is_empty                                                   = SQL statement cannot be null
 sqlquery_is_invalid                                                 = This SQL statement is invalid.
 sqlquery_is_welformed                                               = Notes: Only SELECT query is allowed (Without INTO keyword).
@@ -333,3 +335,18 @@
 yesterday															= Yesterday
 last_7_days															= Last 7 days
 last_30_days														= Last 30 days
+dynamic_attributes													= Dynamic Attributes
+attribute															= Attribute
+attribute_management												= Attribute Management
+attribute_option													= Attribute Option
+attribute_option_management											= Attribute Option Management
+confirm_delete_attribute											= Do you want to delete this attribute?
+confirm_delete_attribute_option										= Do you want to delete this attribute option?
+value_type															= Value Type
+mandatory															= Mandatory
+indicator															= Indicator
+organisation_unit													= Organisation Unit
+create_new_attribute												= Add Attribute
+edit_attribute														= Edit Attribute 
+create_new_attribute_option											= Add Attribute Option 
+edit_attribute_option												= Edit Attribute Option

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2011-07-27 10:05:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2011-09-07 13:42:12 +0000
@@ -13,8 +13,8 @@
       <param name="page">/dhis-web-maintenance-dataadmin/index.vm</param>
       <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
     </action>
-		
-		<!-- Locking -->
+
+    <!-- Locking -->
 
     <action name="displayLockingForm" class="org.hisp.dhis.dataadmin.action.lock.GetPeriodTypesAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -27,7 +27,8 @@
 
     <action name="getDataSetsForPeriodType" class="org.hisp.dhis.dataadmin.action.lock.GetDataSetsForPeriodTypeAction">
       <result name="success" type="velocity">
-        /dhis-web-maintenance-dataadmin/responseDataSet.vm</result>
+        /dhis-web-maintenance-dataadmin/responseDataSet.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
 
     </action>
@@ -48,19 +49,22 @@
 
     <action name="getPeriodsForLock" class="org.hisp.dhis.dataadmin.action.lock.GetPeriodsForLockAction">
       <result name="success" type="velocity">
-        /dhis-web-commons/ajax/xmlPeriods.vm</result>
+        /dhis-web-commons/ajax/xmlPeriods.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 
     <action name="validateCollectiveDataLocking" class="org.hisp.dhis.dataadmin.action.lock.ValidateCollectiveDataLockingAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="input" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseInput.vm</result>
+        /dhis-web-commons/ajax/jsonResponseInput.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
-		
-		<!-- Maintenance -->
+
+    <!-- Maintenance -->
 
     <action name="displayMaintenanceForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -72,11 +76,12 @@
 
     <action name="performMaintenance" class="org.hisp.dhis.dataadmin.action.maintenance.PerformMaintenanceAction">
       <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+        /dhis-web-maintenance-dataadmin/responseSuccess.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
-		
-		<!-- Resource table -->
+
+    <!-- Resource table -->
 
     <action name="displayResourceTableForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -89,8 +94,8 @@
     <action name="generateResourceTable" class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction">
       <result name="success" type="velocity-xml">/dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
     </action>
-		
-		<!-- Cache -->
+
+    <!-- Cache -->
 
     <action name="showCache" class="org.hisp.dhis.dataadmin.action.cache.ShowCacheAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -102,8 +107,8 @@
     <action name="clearCache" class="org.hisp.dhis.dataadmin.action.cache.ClearCacheAction">
       <result name="success" type="redirect">showCache.action </result>
     </action>
-		
-		<!-- Data integrity -->
+
+    <!-- Data integrity -->
 
     <action name="displayDataIntegrityForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -115,10 +120,11 @@
 
     <action name="getDataIntegrity" class="org.hisp.dhis.dataadmin.action.dataintegrity.GetDataIntegrityAction">
       <result name="success" type="velocity-json">
-        /dhis-web-maintenance-dataadmin/responseDataIntegrity.vm</result>
+        /dhis-web-maintenance-dataadmin/responseDataIntegrity.vm
+      </result>
     </action>
-		
-		<!-- Prune Organisation unit -->
+
+    <!-- Prune Organisation unit -->
 
     <action name="displayPruneOrganisationUnitForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -131,12 +137,14 @@
 
     <action name="pruneOrganisationUnit" class="org.hisp.dhis.dataadmin.action.dataprune.PruneOrganisationUnitAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
     </action>
-		
-		<!-- Statistics -->
+
+    <!-- Statistics -->
 
     <action name="viewStatistics" class="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -151,8 +159,8 @@
         <param name="height">220</param>
       </result>
     </action>
-		
-		<!-- Databrowser -->
+
+    <!-- Databrowser -->
 
     <action name="displayDataBrowserForm" class="org.hisp.dhis.dataadmin.action.databrowser.GetPeriodTypesAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -184,9 +192,9 @@
       <result name="xls" type="gridXlsResult" />
       <result name="pdf" type="gridPdfResult" />
       <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
-    </action> 
-		
-		<!-- Organisation unit merge -->
+    </action>
+
+    <!-- Organisation unit merge -->
 
     <action name="displayOrganisationUnitMergeForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -199,10 +207,11 @@
 
     <action name="mergeOrganisationUnits" class="org.hisp.dhis.dataadmin.action.organisationunitmerge.MergeOrganisationUnitsAction">
       <result name="success" type="redirect">
-        displayOrganisationUnitMergeForm.action</result>
+        displayOrganisationUnitMergeForm.action
+      </result>
     </action>
-		
-		<!-- Duplicate data elimination -->
+
+    <!-- Duplicate data elimination -->
 
     <action name="displayDuplicateDataEliminationForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -215,10 +224,11 @@
 
     <action name="eliminateDuplicateData" class="org.hisp.dhis.dataadmin.action.duplicatedataelimination.EliminateDuplicateDataAction">
       <result name="success" type="redirect">
-        displayDuplicateDataEliminationForm.action</result>
+        displayDuplicateDataEliminationForm.action
+      </result>
     </action>
-		
-		<!-- Data Element Zero Value Storage Management -->
+
+    <!-- Data Element Zero Value Storage Management -->
 
     <action name="zeroValueStorageManagement" class="org.hisp.dhis.dataadmin.action.zerovaluestorage.OpenDataElementsZeroIsSignificantManagerAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -230,8 +240,8 @@
     <action name="updateZeroIsSignificantForDataElements" class="org.hisp.dhis.dataadmin.action.zerovaluestorage.UpdateZeroIsSignificantForDataElementsAction">
       <result name="success" type="redirect">index.action</result>
     </action>
-		
-		<!-- Data archive -->
+
+    <!-- Data archive -->
 
     <action name="displayDataArchiveForm" class="org.hisp.dhis.dataadmin.action.NoAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -243,12 +253,14 @@
 
     <action name="archiveData" class="org.hisp.dhis.dataadmin.action.dataarchive.ArchiveDataAction">
       <result name="success" type="velocity-json">
-        /dhis-web-maintenance-dataadmin/responseNumber.vm</result>
+        /dhis-web-maintenance-dataadmin/responseNumber.vm
+      </result>
     </action>
 
     <action name="getNumberOfOverlaps" class="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapsAction">
       <result name="success" type="velocity-json">
-        /dhis-web-maintenance-dataadmin/responseNumber.vm</result>
+        /dhis-web-maintenance-dataadmin/responseNumber.vm
+      </result>
     </action>
 
     <action name="displayPatientDataArchiveForm" class="org.hisp.dhis.dataadmin.action.NoAction">
@@ -261,28 +273,34 @@
 
     <action name="archivePatientData" class="org.hisp.dhis.dataadmin.action.dataarchive.ArchivePatientDataAction">
       <result name="success" type="velocity-json">
-        /dhis-web-maintenance-dataadmin/responseNumber.vm</result>
+        /dhis-web-maintenance-dataadmin/responseNumber.vm
+      </result>
     </action>
 
     <action name="getNumberOfOverlapingPatientValues" class="org.hisp.dhis.dataadmin.action.dataarchive.GetNumberOfOverlapingPatientValuesAction">
       <result name="success" type="velocity-json">
-        /dhis-web-maintenance-dataadmin/responseNumber.vm</result>
+        /dhis-web-maintenance-dataadmin/responseNumber.vm
+      </result>
     </action>
-		
-		<!-- Min/Max validation -->
+
+    <!-- Min/Max validation -->
 
     <action name="generateMinMaxValue" class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GenerateMinMaxValuesAction">
       <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+        /dhis-web-maintenance-dataadmin/responseSuccess.vm
+      </result>
       <result name="input" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseError.vm</result>
+        /dhis-web-maintenance-dataadmin/responseError.vm
+      </result>
     </action>
 
     <action name="removeMinMaxValue" class="org.hisp.dhis.dataadmin.action.minmaxvalidation.RemoveMinMaxValueAction">
       <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+        /dhis-web-maintenance-dataadmin/responseSuccess.vm
+      </result>
       <result name="input" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseError.vm</result>
+        /dhis-web-maintenance-dataadmin/responseError.vm
+      </result>
     </action>
 
     <action name="getMinMaxValidationParams" class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GetMinMaxValidationParamsAction">
@@ -291,12 +309,13 @@
       <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
       <param name="javascripts">javascript/minMaxValidation.js, javascript/minMaxValidationForm.js </param>
     </action>
-			
-		<!-- Sql View -->
+
+    <!-- Sql View -->
 
     <action name="getSqlViewObject" class="org.hisp.dhis.dataadmin.action.sqlview.GetSqlViewObjectAction">
       <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseSqlViewObject.vm</result>
+        /dhis-web-maintenance-dataadmin/responseSqlViewObject.vm
+      </result>
     </action>
 
     <action name="showSqlViewListForm" class="org.hisp.dhis.dataadmin.action.sqlview.GetSqlViewListAction">
@@ -318,14 +337,17 @@
 
     <action name="validateAddUpdateSqlView" class="org.hisp.dhis.dataadmin.action.sqlview.ValidateAddUpdateSqlViewAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="input" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseInput.vm</result>
+        /dhis-web-commons/ajax/jsonResponseInput.vm
+      </result>
     </action>
 
     <action name="addSqlView" class="org.hisp.dhis.dataadmin.action.sqlview.AddSqlViewAction">
       <result name="success" type="redirect">
-        showSqlViewListForm.action</result>
+        showSqlViewListForm.action
+      </result>
       <result name="error" type="redirect">index.action</result>
       <param name="requiredAuthorities">F_SQLVIEW_ADD</param>
     </action>
@@ -347,27 +369,33 @@
 
     <action name="removeSqlViewObject" class="org.hisp.dhis.dataadmin.action.sqlview.RemoveSqlViewAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
       <param name="requiredAuthorities">F_SQLVIEW_DELETE</param>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 
     <action name="executeSqlViewQuery" class="org.hisp.dhis.dataadmin.action.sqlview.ExecuteSqlViewQueryAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
       <param name="requiredAuthorities">F_SQLVIEW_EXECUTE</param>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 
     <action name="checkViewTableExistence" class="org.hisp.dhis.dataadmin.action.sqlview.CheckViewTableExistenceAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
       <param name="requiredAuthorities">F_SQLVIEW_MANAGEMENT</param>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
@@ -381,13 +409,14 @@
       <param name="requiredAuthorities">F_SQLVIEW_MANAGEMENT</param>
     </action>
 
-	<!-- Constant Name -->
+    <!-- Constant Name -->
 
     <action name="getConstant" class="org.hisp.dhis.dataadmin.action.constant.GetConstantAction">
       <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-dataadmin/responseConstant.vm</result>
+        /dhis-web-maintenance-dataadmin/responseConstant.vm
+      </result>
     </action>
-	
+
     <action name="constant" class="org.hisp.dhis.dataadmin.action.constant.GetConstantListAction">
       <result name="success" type="velocity">/main.vm</result>
       <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
@@ -427,20 +456,136 @@
 
     <action name="validateConstant" class="org.hisp.dhis.dataadmin.action.constant.ValidateConstantAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
-	
+
     <action name="removeConstant" class="org.hisp.dhis.dataadmin.action.constant.RemoveConstantAction">
       <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
       <result name="error" type="velocity-json">
-        /dhis-web-commons/ajax/jsonResponseError.vm</result>
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
       <param name="onExceptionReturn">plainTextError</param>
       <param name="requiredAuthorities">F_CONSTANT_DELETE</param>
     </action>
-	
+
+    <!-- Dynamic Attributes -->
+
+    <action name="attribute" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/attribute.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="attributeOption" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionListAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/attributeOption.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="showAddAttributeForm" class="org.hisp.dhis.dataadmin.action.NoAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/addAttributeForm.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="showAddAttributeOptionForm" class="org.hisp.dhis.dataadmin.action.NoAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/addAttributeOptionForm.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="showUpdateAttributeForm" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/updateAttributeForm.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="showUpdateAttributeOptionForm" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+      <param name="page">/dhis-web-maintenance-dataadmin/updateAttributeOptionForm.vm</param>
+      <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+    </action>
+
+    <action name="addAttribute" class="org.hisp.dhis.dataadmin.action.attribute.AddAttributeOptionAction">
+      <result name="success" type="redirect">attribute.action</result>
+      <result name="error" type="redirect">index.action</result>
+    </action>
+
+    <action name="addAttributeOption" class="org.hisp.dhis.dataadmin.action.attribute.AddAttributeOptionAction">
+      <result name="success" type="redirect">attributeOption.action</result>
+      <result name="error" type="redirect">index.action</result>
+    </action>
+
+    <action name="updateAttribute" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction">
+      <result name="success" type="redirect">attribute.action</result>
+      <result name="error" type="redirect">index.action</result>
+    </action>
+
+    <action name="updateAttributeOption" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeOptionAction">
+      <result name="success" type="redirect">attributeOption.action</result>
+      <result name="error" type="redirect">index.action</result>
+    </action>
+
+    <action name="removeAttribute" class="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <result name="error" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+
+    <action name="removeAttributeOption" class="org.hisp.dhis.dataadmin.action.attribute.RemoveAttributeOptionAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <result name="error" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+
+    <action name="getAttribute" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-dataadmin/responseAttribute.vm</result>
+    </action>
+
+    <action name="getAttributeOption" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-dataadmin/responseAttributeOption.vm</result>
+    </action>
+
+    <action name="validateAttribute" class="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <result name="error" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+
+    <action name="validateAttributeOption" class="org.hisp.dhis.dataadmin.action.attribute.ValidateAttributeOptionAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <result name="error" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseError.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
+
   </package>
 </struts>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,1 @@
+addAttribute
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeOptionForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeOptionForm.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,37 @@
+<script type="text/javascript">
+	jQuery(document).ready(	function()
+	{
+		var rules = getValidationRules("attributeOption");
+
+		validation2( 'addAttributeOptionForm', function( form ){ form.submit(); },
+		{
+			'rules': rules
+		});
+
+		checkValueIsExist( "name", "validateAttributeOption.action" );
+	});
+</script>
+
+<h3>$i18n.getString( "create_new_attribute_option" )</h3>
+
+<form id="addAttributeOptionForm" action="addAttributeOption.action" method="post" >
+
+<table>
+	<tr>
+		<th colspan="2">$i18n.getString( "details" )</th>
+	</tr>
+
+	<tr>
+		<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><input type="text" id="name" name="name" style="width:20em"/></td>
+	</tr>
+
+	<tr>
+		<td colspan="2">
+			<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='attributeOption.action'" style="width:10em"/>
+		</td>
+	</tr>
+</table>
+
+</form>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,91 @@
+<script type="text/javascript">
+	jQuery(document).ready(function() {
+		tableSorter( 'listTable' );
+	});
+ 
+    var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_attribute" ) , "'")';
+    
+    function showAttributeDetails( attributeId )
+	{
+		jQuery.post( 'getAttribute.action',
+			{ 'id':attributeId },
+			function( attributeElement ) {
+				setInnerHTML( 'nameField', getElementValue( attributeElement, 'name' ) );
+				setInnerHTML( 'valuetypeField', getElementValue( attributeElement, 'valueType' ) );
+				setInnerHTML( 'mandatoryField', getElementValue( attributeElement, 'mandatory' ) );
+				setInnerHTML( 'dataelementField', getElementValue( attributeElement, 'dataelement' ) );
+				setInnerHTML( 'indicatorField', getElementValue( attributeElement, 'indicator' ) );
+				setInnerHTML( 'organisationunitField', getElementValue( attributeElement, 'organisationunit' ) );
+				showDetails();
+		});
+	}
+
+	function removeAttribute( attributeId, attributeName )
+	{
+	    removeItem( attributeId, attributeName, i18n_confirm_delete, 'removeAttribute.action' );
+	}
+    
+</script>
+
+<h3>$i18n.getString( "attribute_management" ) #openHelp( "attribute" )</h3>
+
+<table class="mainPageTable">
+	<tr>
+		<td style="vertical-align:top">
+			<table width="100%">
+				<tr>
+					<td>#filterDiv( "attribute" )</td>
+					<td colspan="4" style="text-align:right">
+						<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddAttributeForm.action'" style="width:80px"/>
+					</td>
+				</tr>
+			</table>
+			<table class="listTable" id="listTable">
+				<col/>
+				<col width="96px"/>			
+                <thead>				
+				<tr>
+					<th>$i18n.getString( "name" )</th>
+					<th class="{sorter: false}">$i18n.getString( "operations" )</th>
+				</tr>
+                </thead>
+				<tbody id="list">
+				#foreach( $attribute in $attributes )
+				<tr id="tr${attribute.id}">
+					<td onclick="javascript:showAttributeDetails( $attribute.id )">$encoder.htmlEncode( $attribute.name )</td>
+					<td style="text-align:right">
+						<a href="showUpdateAttributeForm.action?id=$attribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+						<a href="javascript:removeAttribute( $attribute.id, '$encoder.jsEncode( $attribute.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+						<a href="javascript:showAttributeDetails( $attribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+					</td>
+				</tr>
+				#end
+				</tbody>
+			</table>
+			<p></p>
+			#parse( "/dhis-web-commons/paging/paging.vm" )
+		</td>
+
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+				</div>
+				<p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+				<p><label>$i18n.getString( "value_type" ):</label><br/><span id="valuetypeField"></span></p>
+				<p><label>$i18n.getString( "mandatory" ):</label><br/><span id="mandatoryField"></span></p>
+				<p><label>$i18n.getString( "data_element" ):</label><br/><span id="dataelementField"></span></p>
+				<p><label>$i18n.getString( "indicator" ):</label><br/><span id="indicatorField"></span></p>
+				<p><label>$i18n.getString( "organisation_unit" ):</label><br/><span id="organisationunitField"></span></p>
+			</div>
+
+			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+                <div style="float:right">
+                    <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+                </div>
+                <p><span id="warningField"></span></p>
+            </div>
+		</td>
+
+	</tr>
+</table>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attributeOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attributeOption.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attributeOption.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,80 @@
+<script type="text/javascript">
+	jQuery(document).ready(function() {
+		tableSorter( 'listTable' );
+	});
+
+    var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_attribute_option" ) , "'")';
+
+    function showAttributeOptionDetails( attributeOptionId )
+	{
+		jQuery.post( 'getAttributeOption.action',
+			{ 'id':attributeOptionId },
+			function( attributeOptionElement ) {
+				setInnerHTML( 'nameField', getElementValue( attributeOptionElement, 'name' ) );
+				showDetails();
+		});
+	}
+
+	function removeAttributeOption( attributeOptionId, attributeOptionName )
+	{
+	    removeItem( attributeOptionId, attributeOptionName, i18n_confirm_delete, 'removeAttributeOption.action' );
+	}
+</script>
+
+<h3>$i18n.getString( "attribute_option_management" ) #openHelp( "attribute_option" )</h3>
+
+<table class="mainPageTable">
+	<tr>
+		<td style="vertical-align:top">
+			<table width="100%">
+				<tr>
+					<td>#filterDiv( "attribute_option" )</td>
+					<td colspan="4" style="text-align:right">
+						<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddAttributeOptionForm.action'" style="width:80px"/>
+					</td>
+				</tr>
+			</table>
+			<table class="listTable" id="listTable">
+				<col/>
+				<col width="96px"/>			
+                <thead>				
+				<tr>
+					<th>$i18n.getString( "name" )</th>
+					<th class="{sorter: false}">$i18n.getString( "operations" )</th>
+				</tr>
+                </thead>
+				<tbody id="list">
+				#foreach( $attributeOption in $attributeOptions )
+				<tr id="tr${attributeOption.id}">
+					<td onclick="javascript:showAttributeOptionDetails( $attributeOption.id )">$encoder.htmlEncode( $attributeOption.name )</td>
+					<td style="text-align:right">
+						<a href="showUpdateAttributeOptionForm.action?id=$attributeOption.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+						<a href="javascript:removeAttributeOption( $attributeOption.id, '$encoder.jsEncode( $attributeOption.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+						<a href="javascript:showAttributeOptionDetails( $attributeOption.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+					</td>
+				</tr>
+				#end
+				</tbody>
+			</table>
+			<p></p>
+			#parse( "/dhis-web-commons/paging/paging.vm" )
+		</td>
+		
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+				</div>
+				<p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+			</div>
+
+			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+                <div style="float:right">
+                    <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+                </div>
+                <p><span id="warningField"></span></p>
+            </div>
+		</td>
+		
+	</tr>
+</table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm	2011-06-30 07:55:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm	2011-09-07 13:42:12 +0000
@@ -24,4 +24,6 @@
 	#introListImgItem( "getMinMaxValidationParams.action" "min_max_value_generation" "minmaxvaluegeneration" ) 
     #introListImgItem( "showCache.action" "cache_statistics" "cachestatistics" )
     #introListImgItem( "constant.action" "constant" "constant" )
+	#introListImgItem( "attribute.action" "attribute" "constant" )
+	#introListImgItem( "attributeOption.action" "attribute_option" "constant" )
 </ul>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm	2011-06-30 07:55:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm	2011-09-07 13:42:12 +0000
@@ -24,3 +24,10 @@
 <ul>
 	<li><a href="showCache.action">$i18n.getString( "cache_statistics" )&nbsp;</a></li>
 </ul>
+
+<h2>$i18n.getString( "dynamic_attributes" )&nbsp;</h2>
+
+<ul>
+	<li><a href="attribute.action">$i18n.getString( "attribute" )&nbsp;</a></li>
+	<li><a href="attributeOption.action">$i18n.getString( "attribute_option" )&nbsp;</a></li>
+</ul>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttribute.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttribute.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<attribute>
+  <id>$attribute.id</id>
+  <name>$encoder.xmlEncode( $attribute.name )</name>
+  <valueType>$encoder.xmlEncode( $attribute.valueType )</valueType>
+  <mandatory>$attribute.mandatory</mandatory>
+  <dataelement>$attribute.dataElement</dataelement>
+  <indicator>$attribute.indicator</indicator>
+  <organisationunit>$attribute.organisationUnit</organisationunit>
+</attribute>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttributeOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttributeOption.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseAttributeOption.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<attributeOption>
+  <id>$attributeOption.id</id>
+  <name>$encoder.xmlEncode( $attributeOption.name )</name>
+</attributeOption>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,1 @@
+updateAttribute
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeOptionForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeOptionForm.vm	2011-09-07 13:42:12 +0000
@@ -0,0 +1,38 @@
+<script type="text/javascript">
+	jQuery(document).ready(	function()
+	{
+		var rules = getValidationRules("attributeOption");
+
+		validation2( 'updateAttributeOptionForm', function( form ){ form.submit(); },
+		{
+			'rules': rules
+		});
+
+		checkValueIsExist( "name", "validateAttributeOption.action" );
+	});
+</script>
+
+<h3>$i18n.getString( "edit_attribute_option" )</h3>
+
+<form id="updateAttributeOptionForm" action="updateAttributeOption.action" method="post" >
+<input type="hidden" id="id" name="id" value="$!attributeOption.id"/>
+
+<table>
+	<tr>
+		<th colspan="2">$i18n.getString( "details" )</th>
+	</tr>
+
+	<tr>
+		<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $!attributeOption.name )" style="width:20em"/></td>
+	</tr>
+
+	<tr>
+		<td colspan="2">
+			<input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='attributeOption.action'" style="width:10em"/>
+		</td>
+	</tr>
+</table>
+
+</form>