dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18748
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7935: local vn - Implemented a new GUI for modifying "Organisation Unit Prototype (Group)"
------------------------------------------------------------
revno: 7935
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-08-20 14:13:48 +0700
message:
local vn - Implemented a new GUI for modifying "Organisation Unit Prototype (Group)"
added:
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/DefaultOrganisationUnitPrototypeService.java
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototype.java
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeGroup.java
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeService.java
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeStore.java
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate/
local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate/HibernateOrganisationUnitPrototypeStore.java
local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/
local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/
local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototype.hbm.xml
local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototypeGroup.hbm.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/AddOrgUnitPrototypeAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeListAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/RemoveOrgUnitPrototypeAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/UpdateOrgUnitPrototypeAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/ValidateOrgUnitPrototypeAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/AddOrgUnitPrototypeGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupListAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/RemoveOrgUnitPrototypeGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/UpdateOrgUnitPrototypeGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/ValidateOrgUnitPrototypeGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeForm.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeGroupForm.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototype.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototypeGroup.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototype.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroup.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroups.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypes.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototype.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototypeGroup.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgPrototypeForm.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeGroupForm.vm
modified:
local/vn/dhis-service-vn/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.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
=== added directory 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype'
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/DefaultOrganisationUnitPrototypeService.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/DefaultOrganisationUnitPrototypeService.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/DefaultOrganisationUnitPrototypeService.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,285 @@
+package org.hisp.dhis.organisationunitprototype;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static org.hisp.dhis.i18n.I18nUtils.getCountByName;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsByName;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.system.util.Filter;
+import org.hisp.dhis.system.util.FilterUtils;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+@Transactional
+public class DefaultOrganisationUnitPrototypeService
+ implements OrganisationUnitPrototypeService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitPrototypeStore organisationUnitPrototypeStore;
+
+ public void setOrganisationUnitPrototypeTypeStore( OrganisationUnitPrototypeStore organisationUnitPrototypeStore )
+ {
+ this.organisationUnitPrototypeStore = organisationUnitPrototypeStore;
+ }
+
+ private GenericIdentifiableObjectStore<OrganisationUnitPrototypeGroup> organisationUnitPrototypeGroupStore;
+
+ public void setOrganisationUnitPrototypeGroupStore(
+ GenericIdentifiableObjectStore<OrganisationUnitPrototypeGroup> organisationUnitPrototypeGroupStore )
+ {
+ this.organisationUnitPrototypeGroupStore = organisationUnitPrototypeGroupStore;
+ }
+
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
+ // -------------------------------------------------------------------------
+ // OrganisationUnitPrototype
+ // -------------------------------------------------------------------------
+
+ public int addOrganisationUnitPrototype( OrganisationUnitPrototype orgUnitPrototype )
+ {
+ return organisationUnitPrototypeStore.save( orgUnitPrototype );
+ }
+
+ public void updateOrganisationUnitPrototype( OrganisationUnitPrototype orgUnitPrototype )
+ {
+ organisationUnitPrototypeStore.update( orgUnitPrototype );
+ }
+
+ public void deleteOrganisationUnitPrototype( OrganisationUnitPrototype orgUnitPrototype )
+ {
+ organisationUnitPrototypeStore.delete( orgUnitPrototype );
+ }
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototype( int id )
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.get( id ) );
+ }
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototype( String uid )
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getByUid( uid ) );
+ }
+
+ public Collection<OrganisationUnitPrototype> getAllOrganisationUnitPrototypes()
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getAll() );
+ }
+
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypes( final Collection<Integer> identifiers )
+ {
+ Collection<OrganisationUnitPrototype> orgUnitPrototypes = getAllOrganisationUnitPrototypes();
+
+ return identifiers == null ? orgUnitPrototypes : FilterUtils.filter( orgUnitPrototypes,
+ new Filter<OrganisationUnitPrototype>()
+ {
+ public boolean retain( OrganisationUnitPrototype object )
+ {
+ return identifiers.contains( object.getId() );
+ }
+ } );
+ }
+
+ public List<OrganisationUnitPrototype> getOrganisationUnitPrototypesByUid( Collection<String> uids )
+ {
+ return organisationUnitPrototypeStore.getByUid( uids );
+ }
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototypeByName( String name )
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getByName( name ) );
+ }
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototypeByCode( String code )
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getByCode( code ) );
+ }
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototypeByShortName( String shortName )
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getByShortName( shortName ) );
+ }
+
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesWithoutGroups()
+ {
+ return i18n( i18nService, organisationUnitPrototypeStore.getOrganisationUnitPrototypesWithoutGroups() );
+ }
+
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesLikeName( String name )
+ {
+ return getObjectsByName( i18nService, organisationUnitPrototypeStore, name );
+ }
+
+ public int getOrganisationUnitPrototypeCount()
+ {
+ return organisationUnitPrototypeStore.getCount();
+ }
+
+ public int getOrganisationUnitPrototypeCountByName( String name )
+ {
+ return getCountByName( i18nService, organisationUnitPrototypeStore, name );
+ }
+
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesBetween( int first, int max )
+ {
+ return getObjectsBetween( i18nService, organisationUnitPrototypeStore, first, max );
+ }
+
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesBetweenByName( String name, int first,
+ int max )
+ {
+ return getObjectsBetweenByName( i18nService, organisationUnitPrototypeStore, name, first, max );
+ }
+
+ // -------------------------------------------------------------------------
+ // OrganisationUnitPrototypeGroup
+ // -------------------------------------------------------------------------
+
+ public int addOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup )
+ {
+ return organisationUnitPrototypeGroupStore.save( orgUnitPrototypeGroup );
+ }
+
+ public void updateOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup )
+ {
+ organisationUnitPrototypeGroupStore.update( orgUnitPrototypeGroup );
+ }
+
+ public void deleteOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup )
+ {
+ organisationUnitPrototypeGroupStore.delete( orgUnitPrototypeGroup );
+ }
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( int id )
+ {
+ return i18n( i18nService, organisationUnitPrototypeGroupStore.get( id ) );
+ }
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( int id,
+ boolean i18nOrganisationUnitPrototypes )
+ {
+ OrganisationUnitPrototypeGroup group = getOrganisationUnitPrototypeGroup( id );
+
+ if ( i18nOrganisationUnitPrototypes )
+ {
+ i18n( i18nService, group.getMembers() );
+ }
+
+ return group;
+ }
+
+ public Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroups(
+ final Collection<Integer> identifiers )
+ {
+ Collection<OrganisationUnitPrototypeGroup> groups = getAllOrganisationUnitPrototypeGroups();
+
+ return identifiers == null ? groups : FilterUtils.filter( groups, new Filter<OrganisationUnitPrototypeGroup>()
+ {
+ public boolean retain( OrganisationUnitPrototypeGroup object )
+ {
+ return identifiers.contains( object.getId() );
+ }
+ } );
+ }
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( String uid )
+ {
+ return i18n( i18nService, organisationUnitPrototypeGroupStore.getByUid( uid ) );
+ }
+
+ public Collection<OrganisationUnitPrototypeGroup> getAllOrganisationUnitPrototypeGroups()
+ {
+ return i18n( i18nService, organisationUnitPrototypeGroupStore.getAll() );
+ }
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroupByName( String name )
+ {
+ return i18n( i18nService, organisationUnitPrototypeGroupStore.getByName( name ) );
+ }
+
+ public Collection<OrganisationUnitPrototypeGroup> getGroupsContainingOrganisationUnitPrototype(
+ OrganisationUnitPrototype orgUnitPrototype )
+ {
+ Collection<OrganisationUnitPrototypeGroup> groups = getAllOrganisationUnitPrototypeGroups();
+
+ Iterator<OrganisationUnitPrototypeGroup> iterator = groups.iterator();
+
+ while ( iterator.hasNext() )
+ {
+ OrganisationUnitPrototypeGroup group = iterator.next();
+
+ if ( !group.getMembers().contains( orgUnitPrototype ) )
+ {
+ iterator.remove();
+ }
+ }
+
+ return groups;
+ }
+
+ public int getOrganisationUnitPrototypeGroupCount()
+ {
+ return organisationUnitPrototypeGroupStore.getCount();
+ }
+
+ public int getOrganisationUnitPrototypeGroupCountByName( String name )
+ {
+ return getCountByName( i18nService, organisationUnitPrototypeGroupStore, name );
+ }
+
+ public Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroupsBetween( int first, int max )
+ {
+ return getObjectsBetween( i18nService, organisationUnitPrototypeGroupStore, first, max );
+ }
+
+ public Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroupsBetweenByName( String name,
+ int first, int max )
+ {
+ return getObjectsBetweenByName( i18nService, organisationUnitPrototypeGroupStore, name, first, max );
+ }
+}
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototype.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototype.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototype.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,145 @@
+package org.hisp.dhis.organisationunitprototype;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.common.BaseNameableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+@JacksonXmlRootElement( localName = "orgUnitProtoype", namespace = Dxf2Namespace.NAMESPACE )
+public class OrganisationUnitPrototype
+ extends BaseNameableObject
+{
+ private Set<OrganisationUnitPrototypeGroup> groups = new HashSet<OrganisationUnitPrototypeGroup>();
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public OrganisationUnitPrototype()
+ {
+ }
+
+ public OrganisationUnitPrototype( String name )
+ {
+ this.name = name;
+ }
+
+ public OrganisationUnitPrototype( String name, String shortName )
+ {
+ this.name = name;
+ this.shortName = shortName;
+ }
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public void addOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup )
+ {
+ groups.add( orgUnitPrototypeGroup );
+ orgUnitPrototypeGroup.getMembers().add( this );
+ }
+
+ public void removeOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup )
+ {
+ groups.remove( orgUnitPrototypeGroup );
+ orgUnitPrototypeGroup.getMembers().remove( this );
+ }
+
+ public void removeAllOrganisationUnitPrototypeGroups()
+ {
+ for ( OrganisationUnitPrototypeGroup orgUnitPrototypeGroup : groups )
+ {
+ orgUnitPrototypeGroup.getMembers().remove( this );
+ }
+
+ groups.clear();
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode, equals and toString
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof OrganisationUnitPrototype) )
+ {
+ return false;
+ }
+
+ final OrganisationUnitPrototype other = (OrganisationUnitPrototype) o;
+
+ return name.equals( other.getName() );
+ }
+
+ @Override
+ public String toString()
+ {
+ return "[" + name + "]";
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public Set<OrganisationUnitPrototypeGroup> getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups( Set<OrganisationUnitPrototypeGroup> groups )
+ {
+ this.groups = groups;
+ }
+}
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeGroup.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeGroup.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeGroup.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,153 @@
+package org.hisp.dhis.organisationunitprototype;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.annotation.Scanned;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+@JacksonXmlRootElement( localName = "orgUnitPrototypeGroup", namespace = Dxf2Namespace.NAMESPACE )
+public class OrganisationUnitPrototypeGroup
+ extends BaseIdentifiableObject
+{
+ @Scanned
+ private Set<OrganisationUnitPrototype> members = new HashSet<OrganisationUnitPrototype>();
+
+ public OrganisationUnitPrototypeGroup()
+ {
+ }
+
+ public OrganisationUnitPrototypeGroup( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public void addOrganisationUnitPrototype( OrganisationUnitPrototype orgUnitPrototype )
+ {
+ members.add( orgUnitPrototype );
+ orgUnitPrototype.getGroups().add( this );
+ }
+
+ public void removeOrganisationUnitPrototype( OrganisationUnitPrototype orgUnitPrototype )
+ {
+ members.remove( orgUnitPrototype );
+ orgUnitPrototype.getGroups().remove( this );
+ }
+
+ public void removeAllOrganisationUnitPrototypes()
+ {
+ for ( OrganisationUnitPrototype orgUnitPrototype : members )
+ {
+ orgUnitPrototype.getGroups().remove( this );
+ }
+
+ members.clear();
+ }
+
+ public void updateOrganisationUnitPrototypes( Set<OrganisationUnitPrototype> updates )
+ {
+ for ( OrganisationUnitPrototype unitPrototype : new HashSet<OrganisationUnitPrototype>( members ) )
+ {
+ if ( !updates.contains( unitPrototype ) )
+ {
+ removeOrganisationUnitPrototype( unitPrototype );
+ }
+ }
+
+ for ( OrganisationUnitPrototype unitPrototype : updates )
+ {
+ addOrganisationUnitPrototype( unitPrototype );
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof OrganisationUnitPrototypeGroup) )
+ {
+ return false;
+ }
+
+ final OrganisationUnitPrototypeGroup other = (OrganisationUnitPrototypeGroup) o;
+
+ return name.equals( other.getName() );
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ @JsonProperty( value = "orgUnitPrototypes" )
+ @JsonSerialize( contentAs = BaseIdentifiableObject.class )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "orgUnitPrototypes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "orgUnitPrototype", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OrganisationUnitPrototype> getMembers()
+ {
+ return members;
+ }
+
+ public void setMembers( Set<OrganisationUnitPrototype> members )
+ {
+ this.members = members;
+ }
+}
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeService.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeService.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeService.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,114 @@
+package org.hisp.dhis.organisationunitprototype;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface OrganisationUnitPrototypeService
+{
+ String ID = OrganisationUnitPrototypeService.class.getName();
+
+ // -------------------------------------------------------------------------
+ // OrganisationUnitPrototype
+ // -------------------------------------------------------------------------
+
+ int addOrganisationUnitPrototype( OrganisationUnitPrototype indicator );
+
+ void updateOrganisationUnitPrototype( OrganisationUnitPrototype indicator );
+
+ void deleteOrganisationUnitPrototype( OrganisationUnitPrototype indicator );
+
+ OrganisationUnitPrototype getOrganisationUnitPrototype( int id );
+
+ OrganisationUnitPrototype getOrganisationUnitPrototype( String uid );
+
+ Collection<OrganisationUnitPrototype> getAllOrganisationUnitPrototypes();
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypes( Collection<Integer> identifiers );
+
+ List<OrganisationUnitPrototype> getOrganisationUnitPrototypesByUid( Collection<String> uids );
+
+ OrganisationUnitPrototype getOrganisationUnitPrototypeByName( String name );
+
+ OrganisationUnitPrototype getOrganisationUnitPrototypeByCode( String code );
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesWithoutGroups();
+
+ int getOrganisationUnitPrototypeCountByName( String name );
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesLikeName( String name );
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesBetweenByName( String name, int first, int max );
+
+ int getOrganisationUnitPrototypeCount();
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesBetween( int first, int max );
+
+ // -------------------------------------------------------------------------
+ // OrganisationUnitPrototypeGroup
+ // -------------------------------------------------------------------------
+
+ int addOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup indicatorGroup );
+
+ void updateOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup indicatorGroup );
+
+ void deleteOrganisationUnitPrototypeGroup( OrganisationUnitPrototypeGroup indicatorGroup );
+
+ OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( int id );
+
+ OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( int id, boolean i18nOrganisationUnitPrototypes );
+
+ Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroups( Collection<Integer> identifiers );
+
+ OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup( String uid );
+
+ Collection<OrganisationUnitPrototypeGroup> getAllOrganisationUnitPrototypeGroups();
+
+ OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroupByName( String name );
+
+ Collection<OrganisationUnitPrototypeGroup> getGroupsContainingOrganisationUnitPrototype(
+ OrganisationUnitPrototype indicator );
+
+ Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroupsBetween( int first, int max );
+
+ Collection<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroupsBetweenByName( String name, int first,
+ int max );
+
+ int getOrganisationUnitPrototypeGroupCount();
+
+ int getOrganisationUnitPrototypeGroupCountByName( String name );
+}
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeStore.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeStore.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/OrganisationUnitPrototypeStore.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,44 @@
+package org.hisp.dhis.organisationunitprototype;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericNameableObjectStore;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface OrganisationUnitPrototypeStore
+ extends GenericNameableObjectStore<OrganisationUnitPrototype>
+{
+ String ID = OrganisationUnitPrototypeStore.class.getName();
+
+ Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesWithoutGroups();
+}
\ No newline at end of file
=== added directory 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate'
=== added file 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate/HibernateOrganisationUnitPrototypeStore.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate/HibernateOrganisationUnitPrototypeStore.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/organisationunitprototype/hibernate/HibernateOrganisationUnitPrototypeStore.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,55 @@
+package org.hisp.dhis.organisationunitprototype.hibernate;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeStore;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class HibernateOrganisationUnitPrototypeStore
+ extends HibernateIdentifiableObjectStore<OrganisationUnitPrototype>
+ implements OrganisationUnitPrototypeStore
+{
+ // -------------------------------------------------------------------------
+ // OrganisationUnitPrototype
+ // -------------------------------------------------------------------------
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<OrganisationUnitPrototype> getOrganisationUnitPrototypesWithoutGroups()
+ {
+ final String hql = "from OrganisationUnitPrototype d where d.groups.size = 0";
+
+ return getQuery( hql ).setCacheable( true ).list();
+ }
+}
=== modified file 'local/vn/dhis-service-vn/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-service-vn/src/main/resources/META-INF/dhis/beans.xml 2012-08-14 19:13:01 +0000
+++ local/vn/dhis-service-vn/src/main/resources/META-INF/dhis/beans.xml 2012-08-20 07:13:48 +0000
@@ -44,5 +44,20 @@
<property name="sessionFactory" ref="sessionFactory" />
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</bean>
-
+
+ <!-- OrganisationUnitPrototype -->
+
+ <bean id="org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeStore"
+ class="org.hisp.dhis.organisationunitprototype.hibernate.HibernateOrganisationUnitPrototypeStore">
+ <property name="clazz" value="org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="cacheable" value="true" />
+ </bean>
+
+ <bean id="org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService"
+ class="org.hisp.dhis.organisationunitprototype.DefaultOrganisationUnitPrototypeService">
+ <property name="organisationUnitPrototypeStore" ref="org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeStore" />
+ <property name="organisationUnitPrototypeGroupStore" ref="org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroupStore" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+ </bean>
</beans>
=== added directory 'local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype'
=== added directory 'local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate'
=== added file 'local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototype.hbm.xml'
--- local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototype.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototype.hbm.xml 2012-08-20 07:13:48 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.organisationunit.OrganisationUnitPrototype" table="orgunitprototype">
+
+ <id name="id" column="orgunitprototypeid">
+ <generator class="native" />
+ </id>
+ &identifiableProperties;
+
+ <property name="shortName" column="shortname" not-null="true" unique="false" length="50" />
+
+ <set name="groups" table="orgunitprototypegroupmembers" inverse="true">
+ <cache usage="read-write" />
+ <key column="orgunitprototypeid" />
+ <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitPrototypeGroup" column="orgunitprototypegroupid" />
+ </set>
+
+ </class>
+</hibernate-mapping>
=== added file 'local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototypeGroup.hbm.xml'
--- local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototypeGroup.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-vn/src/main/resources/org/hisp/dhis/organisationunitprototype/hibernate/OrganisationUnitPrototypeGroup.hbm.xml 2012-08-20 07:13:48 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.organisationunit.OrganisationUnitPrototypeGroup" table="orgunitprototypegroup">
+
+ <cache usage="read-write" />
+
+ <id name="id" column="orgunitprototypegroupid">
+ <generator class="native" />
+ </id>
+ &identifiableProperties;
+
+ <set name="members" table="orgunitprototypegroupmembers">
+ <cache usage="read-write" />
+ <key column="orgunitprototypegroupid" foreign-key="fk_orgunitprototypegroupmembers_orgunitprototypegroupid" />
+ <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitPrototype" column="orgunitprototypeid"
+ foreign-key="fk_orgunitprototypegroup_orgunitprototypeid" />
+ </set>
+
+ </class>
+</hibernate-mapping>
=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype'
=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action'
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/AddOrgUnitPrototypeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/AddOrgUnitPrototypeAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/AddOrgUnitPrototypeAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,80 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class AddOrgUnitPrototypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ OrganisationUnitPrototype orgUnitPrototype = new OrganisationUnitPrototype( name, shortName );
+
+ organisationUnitPrototypeService.addOrganisationUnitPrototype( orgUnitPrototype );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetOrgUnitPrototypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitPrototype organisationUnitPrototype;
+
+ public OrganisationUnitPrototype getOrganisationUnitPrototype()
+ {
+ return organisationUnitPrototype;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ organisationUnitPrototype = organisationUnitPrototypeService.getOrganisationUnitPrototype( id );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeListAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeListAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/GetOrgUnitPrototypeListAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,107 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetOrgUnitPrototypeListAction
+ extends ActionPagingSupport<OrganisationUnitPrototype>
+{
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnitPrototype> organisationUnitPrototypes;
+
+ public List<OrganisationUnitPrototype> getOrganisationUnitPrototypes()
+ {
+ return organisationUnitPrototypes;
+ }
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( organisationUnitPrototypeService.getOrganisationUnitPrototypeCountByName( key ) );
+
+ organisationUnitPrototypes = new ArrayList<OrganisationUnitPrototype>( organisationUnitPrototypeService.getOrganisationUnitPrototypesBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( organisationUnitPrototypeService.getOrganisationUnitPrototypeCount() );
+
+ organisationUnitPrototypes = new ArrayList<OrganisationUnitPrototype>( organisationUnitPrototypeService.getOrganisationUnitPrototypesBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
+ Collections.sort( organisationUnitPrototypes, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/RemoveOrgUnitPrototypeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/RemoveOrgUnitPrototypeAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/RemoveOrgUnitPrototypeAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,106 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class RemoveOrgUnitPrototypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ try
+ {
+ organisationUnitPrototypeService.deleteOrganisationUnitPrototype( organisationUnitPrototypeService.getOrganisationUnitPrototype( id ) );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+
+ return ERROR;
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/UpdateOrgUnitPrototypeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/UpdateOrgUnitPrototypeAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/UpdateOrgUnitPrototypeAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,91 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateOrgUnitPrototypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ OrganisationUnitPrototype organisationUnitPrototype = organisationUnitPrototypeService.getOrganisationUnitPrototype( id );
+
+ organisationUnitPrototype.setName( name );
+ organisationUnitPrototype.setShortName( shortName );
+
+ organisationUnitPrototypeService.updateOrganisationUnitPrototype( organisationUnitPrototype );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/ValidateOrgUnitPrototypeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/ValidateOrgUnitPrototypeAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototype/action/ValidateOrgUnitPrototypeAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,111 @@
+package org.hisp.dhis.reportsheet.orgunitprototype.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ValidateOrgUnitPrototypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( name != null )
+ {
+ OrganisationUnitPrototype match = organisationUnitPrototypeService.getOrganisationUnitPrototypeByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return ERROR;
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup'
=== added directory 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action'
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/AddOrgUnitPrototypeGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/AddOrgUnitPrototypeGroupAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/AddOrgUnitPrototypeGroupAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class AddOrgUnitPrototypeGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Set<String> groupMembers = new HashSet<String>();
+
+ public void setGroupMembers( Set<String> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ OrganisationUnitPrototypeGroup organisationUnitPrototypeGroup = new OrganisationUnitPrototypeGroup( name );
+
+ for ( String id : groupMembers )
+ {
+ organisationUnitPrototypeGroup.addOrganisationUnitPrototype( organisationUnitPrototypeService
+ .getOrganisationUnitPrototype( Integer.parseInt( id ) ) );
+ }
+
+ organisationUnitPrototypeService.addOrganisationUnitPrototypeGroup( organisationUnitPrototypeGroup );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,87 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetOrgUnitPrototypeGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private OrganisationUnitPrototypeGroup organisationUnitPrototypeGroup;
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup()
+ {
+ return organisationUnitPrototypeGroup;
+ }
+
+ private int memberCount;
+
+ public int getMemberCount()
+ {
+ return memberCount;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ organisationUnitPrototypeGroup = organisationUnitPrototypeService.getOrganisationUnitPrototypeGroup( id );
+
+ memberCount = organisationUnitPrototypeGroup.getMembers().size();
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupListAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupListAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/GetOrgUnitPrototypeGroupListAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,102 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetOrgUnitPrototypeGroupListAction
+ extends ActionPagingSupport<OrganisationUnitPrototypeGroup>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnitPrototypeGroup> organisationUnitPrototypeGroups;
+
+ public List<OrganisationUnitPrototypeGroup> getOrganisationUnitPrototypeGroups()
+ {
+ return organisationUnitPrototypeGroups;
+ }
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( organisationUnitPrototypeService.getOrganisationUnitPrototypeGroupCountByName( key ) );
+
+ organisationUnitPrototypeGroups = new ArrayList<OrganisationUnitPrototypeGroup>( organisationUnitPrototypeService.getOrganisationUnitPrototypeGroupsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( organisationUnitPrototypeService.getOrganisationUnitPrototypeGroupCount() );
+
+ organisationUnitPrototypeGroups = new ArrayList<OrganisationUnitPrototypeGroup>( organisationUnitPrototypeService.getOrganisationUnitPrototypeGroupsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
+ Collections.sort( organisationUnitPrototypeGroups, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/RemoveOrgUnitPrototypeGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/RemoveOrgUnitPrototypeGroupAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/RemoveOrgUnitPrototypeGroupAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,108 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class RemoveOrgUnitPrototypeGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ try
+ {
+ organisationUnitPrototypeService.deleteOrganisationUnitPrototypeGroup( organisationUnitPrototypeService.getOrganisationUnitPrototypeGroup( id ) );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+
+ return ERROR;
+ }
+ }
+
+ message = i18n.getString( "item_deleted_successfully" );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/UpdateOrgUnitPrototypeGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/UpdateOrgUnitPrototypeGroupAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/UpdateOrgUnitPrototypeGroupAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,112 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototype;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateOrgUnitPrototypeGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Set<String> groupMembers = new HashSet<String>();
+
+ public void setGroupMembers( Set<String> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ private OrganisationUnitPrototypeGroup organisationUnitPrototypeGroup;
+
+ public OrganisationUnitPrototypeGroup getOrganisationUnitPrototypeGroup()
+ {
+ return organisationUnitPrototypeGroup;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ organisationUnitPrototypeGroup = organisationUnitPrototypeService.getOrganisationUnitPrototypeGroup( id );
+
+ if ( name != null && name.trim().length() > 0 )
+ {
+ organisationUnitPrototypeGroup.setName( name );
+ }
+
+ Set<OrganisationUnitPrototype> members = new HashSet<OrganisationUnitPrototype>();
+
+ for ( String memberId : groupMembers )
+ {
+ members.add( organisationUnitPrototypeService.getOrganisationUnitPrototype( Integer.parseInt( memberId ) ) );
+ }
+
+ organisationUnitPrototypeGroup.updateOrganisationUnitPrototypes( members );
+
+ organisationUnitPrototypeService.updateOrganisationUnitPrototypeGroup( organisationUnitPrototypeGroup );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/ValidateOrgUnitPrototypeGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/ValidateOrgUnitPrototypeGroupAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/orgunitprototypegroup/action/ValidateOrgUnitPrototypeGroupAction.java 2012-08-20 07:13:48 +0000
@@ -0,0 +1,109 @@
+package org.hisp.dhis.reportsheet.orgunitprototypegroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeGroup;
+import org.hisp.dhis.organisationunitprototype.OrganisationUnitPrototypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ValidateOrgUnitPrototypeGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitPrototypeService organisationUnitPrototypeService;
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( name != null )
+ {
+ OrganisationUnitPrototypeGroup match = organisationUnitPrototypeService.getOrganisationUnitPrototypeGroupByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return ERROR;
+ }
+ }
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-07-12 10:18:47 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-08-20 07:13:48 +0000
@@ -1443,4 +1443,56 @@
<property name="jchartDataService" ref="org.hisp.dhis.jchart.data.JChartDataService" />
</bean>
+ <!-- OrganisationUnitPrototype -->
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.AddOrgUnitPrototypeAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.AddOrgUnitPrototypeAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeListAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeListAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.RemoveOrgUnitPrototypeAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.RemoveOrgUnitPrototypeAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.UpdateOrgUnitPrototypeAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.UpdateOrgUnitPrototypeAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototype.action.ValidateOrgUnitPrototypeAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.ValidateOrgUnitPrototypeAction"
+ scope="prototype" />
+
+ <!-- OrganisationUnitPrototypeGroup -->
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.AddOrgUnitPrototypeGroupAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.AddOrgUnitPrototypeGroupAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.GetOrgUnitPrototypeGroupAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.GetOrgUnitPrototypeGroupAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.GetOrgUnitPrototypeGroupListAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.GetOrgUnitPrototypeGroupListAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.RemoveOrgUnitPrototypeGroupAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.RemoveOrgUnitPrototypeGroupAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.UpdateOrgUnitPrototypeGroupAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.UpdateOrgUnitPrototypeGroupAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.ValidateOrgUnitPrototypeGroupAction"
+ class="org.hisp.dhis.reportsheet.orgunitprototypegroup.action.ValidateOrgUnitPrototypeGroupAction"
+ scope="prototype" />
+
</beans>
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-07-06 19:43:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-08-20 07:13:48 +0000
@@ -1640,6 +1640,151 @@
/dhis-web-spreadsheet-reporting/jsonBookmarks.vm
</result>
</action>
+
+ <!-- OrganisationUnitPrototype -->
+
+ <action name="getOrgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototype.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_MANAGEMENT</param>
+ </action>
+
+ <action name="getOrgUnitPrototypes"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeListAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypes.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_MANAGEMENT</param>
+ </action>
+
+ <action name="orgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+ <param name="page">
+ /dhis-web-spreadsheet-reporting/organisationUnitPrototype.vm</param>
+ <param name="javascripts">javascript/organisationUnitPrototype.js</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_MANAGEMENT</param>
+ </action>
+
+ <action name="showAddOrgUnitPrototypeForm" class="org.hisp.dhis.dataadmin.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+ <param name="page">
+ /dhis-web-spreadsheet-reporting/addOrgUnitPrototypeForm.vm</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_ADD</param>
+ </action>
+
+ <action name="addOrgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.AddOrgUnitPrototypeAction">
+ <result name="success" type="redirect">orgUnitPrototype.action</result>
+ <result name="error" type="redirect">index.action</result>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_ADD</param>
+ </action>
+
+ <action name="showUpdateOrgUnitPrototypeForm"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+ <param name="page">
+ /dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeForm.vm</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_UPDATE</param>
+ </action>
+
+ <action name="updateOrgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.UpdateOrgUnitPrototypeAction">
+ <result name="success" type="redirect">orgUnitPrototype.action</result>
+ <result name="error" type="redirect">index.action</result>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_UPDATE</param>
+ </action>
+
+ <action name="validateOrgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.ValidateOrgUnitPrototypeAction">
+ <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="removeOrgUnitPrototype"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.RemoveOrgUnitPrototypeAction">
+ <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>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_DELETE</param>
+ </action>
+ <!-- OrganisationUnitPrototypeGroup -->
+
+ <action name="orgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeGroupListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-spreadsheet-reporting/organisationUnitPrototypeGroup.vm</param>
+ <param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+ <param name="javascripts">javascript/organisationUnitPrototypeGroup.js</param>
+ </action>
+
+ <action name="getOrgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeGroupAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroup.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_MANAGEMENT</param>
+ </action>
+
+ <action name="getOrgUnitPrototypeGroups"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeGroupListAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroups.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPE_MANAGEMENT</param>
+ </action>
+
+ <action name="removeOrgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.RemoveOrgUnitPrototypeGroupAction">
+ <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>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPEGROUP_DELETE</param>
+ </action>
+
+ <action name="showAddOrgUnitPrototypeGroupForm"
+ class="org.hisp.dhis.reportsheet.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeGroupForm.vm</param>
+ <param name="javascripts">javascript/organisationUnitPrototypeGroup.js</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPEGROUP_ADD</param>
+ </action>
+
+ <action name="addOrgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.AddOrgUnitPrototypeGroupAction">
+ <result name="success" type="redirect">orgUnitPrototypeGroup.action</result>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPEGROUP_ADD</param>
+ </action>
+
+ <action name="showUpdateOrgUnitPrototypeGroupForm"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.GetOrgUnitPrototypeGroupAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeGroupForm.vm</param>
+ <param name="javascripts">javascript/organisationUnitPrototypeGroup.js</param>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPEGROUP_UPDATE</param>
+ </action>
+
+ <action name="updateOrgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.UpdateOrgUnitPrototypeGroupAction">
+ <result name="success" type="redirect">orgUnitPrototypeGroup.action</result>
+ <param name="requiredAuthorities">F_ORGANISATIONUNITPROTOTYPEGROUP_UPDATE</param>
+ </action>
+
+ <action name="validateOrgUnitPrototypeGroup"
+ class="org.hisp.dhis.reportsheet.orgunitprototype.action.ValidateOrgUnitPrototypeGroupAction">
+ <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>
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeForm.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeForm.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,53 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+
+ validation2( 'addOrgUnitPrototypeForm', function( form ){ form.submit(); },
+ {
+ 'rules': getValidationRules( "organisationUnitPrototype" )
+ });
+
+ checkValueIsExist( "name", "validateOrgUnitPrototype.action" );
+ });
+
+</script>
+
+<h3>$i18n.getString( "create_new_organisationunitprototype" )</h3>
+
+<form id="addOrgUnitPrototypeForm" action="addOrgUnitPrototype.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><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="shortName" name="shortName" style="width:20em"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='orgUnitPrototype.action'" style="width:10em"/></td>
+ </tr>
+</table>
+</form>
+
+<script type="text/javascript">
+
+validationRules = {
+
+ "organisationUnitPrototype" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 2, 160 ]
+ },
+ "shortName" : {
+ "required" : true,
+ "rangelength" : [ 2, 49 ]
+ }
+ }
+};
+</script>
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeGroupForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeGroupForm.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/addOrgUnitPrototypeGroupForm.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,89 @@
+<script type="text/javascript">
+ jQuery(function() {
+ validation2('addOrgUnitPrototypeGroupForm', function ( form ) {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function () {
+ beforeSubmit();
+ },
+ 'rules' : getValidationRules( "orgUnitPrototypeGroup" )
+ });
+
+ checkValueIsExist("name", "validateOrgUnitPrototypeGroup.action");
+
+ jQuery("#availableList").dhisAjaxSelect({
+ source: "getOrgUnitPrototypes.action",
+ iterator: "orgUnitPrototypes",
+ connectedTo: 'groupMembers',
+ handler: function(item) {
+ var option = jQuery("<option data-id='" + item.groups + "' />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+ } );
+
+ validationRules = {
+ "orgUnitPrototypeGroup" : {
+ "name" : {
+ "required" : true,
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true,
+ "rangelength" : [ 2, 160 ]
+ }
+ }
+ };
+</script>
+
+<h3>$i18n.getString( "create_new_orgunit_prototype_group" )</h3>
+
+<form id="addOrgUnitPrototypeGroupForm" action="addOrgUnitPrototypeGroup.action" method="post" >
+
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+
+ <tr>
+ <td style="width: 200px;"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td style="min-width: 240px;"><input type="text" id="name" name="name" style="width:240px" /></td>
+ </tr>
+</table>
+
+<table>
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+
+ <tr>
+ <th>$i18n.getString( "available_orgunit_prototype" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
+ </td>
+ </tr>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='orgUnitPrototypeGroup.action'" style="width:10em"/>
+</p>
+
+</form>
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototype.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototype.js 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototype.js 2012-08-20 07:13:48 +0000
@@ -0,0 +1,22 @@
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showOrgUnitPrototypeDetails( id )
+{
+ jQuery.post( 'getOrgUnitPrototype.action', { id:id }, function( json )
+ {
+ setInnerHTML( 'nameField', json.orgUnitPrototype.name );
+ setInnerHTML( 'shortNameField', json.orgUnitPrototype.shortName );
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove OrganisationUnitPrototype
+// -----------------------------------------------------------------------------
+
+function removeOrgUnitPrototype( id, name )
+{
+ removeItem( id, name, i18n_confirm_delete, 'removeOrgUnitPrototype.action' );
+}
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototypeGroup.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototypeGroup.js 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/organisationUnitPrototypeGroup.js 2012-08-20 07:13:48 +0000
@@ -0,0 +1,35 @@
+function beforeSubmit()
+{
+ memberValidator = jQuery( "#memberValidator" );
+ memberValidator.children().remove();
+
+ jQuery.each( jQuery( "#groupMembers" ).children(), function( i, item )
+ {
+ item.selected = 'selected';
+ memberValidator.append( '<option value="' + item.value + '" selected="selected">' + item.value + '</option>' );
+ } );
+}
+
+// -----------------------------------------------------------------------------
+// Show OrganisationUnitPrototype Group details
+// -----------------------------------------------------------------------------
+
+function showOrgUnitPrototypeGroupDetails( groupId )
+{
+ jQuery.get( 'getOrgUnitPrototypeGroup.action',
+ { id: groupId }, function( json ) {
+ setInnerHTML( 'nameField', json.orgUnitPrototypeGroup.name );
+ setInnerHTML( 'memberCountField', json.orgUnitPrototypeGroup.memberCount );
+
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove OrganisationUnitPrototype Group
+// -----------------------------------------------------------------------------
+
+function removeOrgUnitPrototypeGroup( groupId, groupName )
+{
+ removeItem( groupId, groupName, i18n_confirm_delete, 'removeOrgUnitPrototypeGroup.action' );
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototype.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototype.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototype.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,7 @@
+{ "orgUnitPrototype":
+ {
+ "id" : "${organisationUnitPrototype.id}",
+ "name" : "$!encoder.jsonEncode( ${organisationUnitPrototype.displayName} )",
+ "shortName" : "$!encoder.jsonEncode( ${organisationUnitPrototype.displayShortName} )"
+ }
+}
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroup.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroup.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroup.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,7 @@
+{ "orgUnitPrototypeGroup":
+ {
+ "id": "$!{organisationUnitPrototypeGroup.id}",
+ "name": "$!encoder.jsonEncode( ${organisationUnitPrototypeGroup.displayName} )",
+ "memberCount": "$!{memberCount}"
+ }
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroups.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroups.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypeGroups.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,13 @@
+#set( $size = $organisationUnitPrototypeGroups.size() )
+{ "orgUnitPrototypeGroups": [
+#foreach( $group in $organisationUnitPrototypeGroups )
+ {
+ "id": "$group.id",
+ "name": "$!encoder.jsonEncode( ${group.displayName} )"
+ }#if( $velocityCount < $size ),#end
+#end
+]
+#if( $usePaging ),
+ "paging":#parse( "/dhis-web-commons/ajax/jsonPaging.vm" )
+#end
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypes.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypes.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonOrganisationUnitPrototypes.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,13 @@
+{
+ #set( $size = $!organisationUnitPrototypes.size() )
+ "orgUnitPrototypes": [
+ #foreach( $orgUnitPrototype in $!organisationUnitPrototypes )
+ {
+ "id": "${orgUnitPrototype.id}",
+ "name": "$!encoder.jsonEncode( ${orgUnitPrototype.displayName} )",
+ "shortName": "$!encoder.jsonEncode( ${orgUnitPrototype.displayShortName} )",
+ "groups": [ #foreach( $group in $orgUnitPrototype.groups )${group.id}#if( $velocityCount < $groups.size() ),#end#end ]
+ }#if( $velocityCount < $size ),#end
+ #end
+ ]
+}
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototype.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototype.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototype.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,64 @@
+<script type="text/javascript">
+ jQuery(document).ready(function() {
+ tableSorter( 'listTable' );
+ });
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_orgunit_prototype" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "orgunit_prototype_management" ) #openHelp( "organisationUnitPrototype" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "orgUnitPrototype" )</td>
+ <td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrgUnitPrototypeForm.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( $orgUnitPrototype in $organisationUnitPrototypes )
+ <tr id="tr${orgUnitPrototype.id}">
+ <td onclick="javascript:showOrgUnitPrototypeDetails( $orgUnitPrototype.id )">$!encoder.htmlEncode( $orgUnitPrototype.name )</td>
+ <td style="text-align:right">
+ <a href="showUpdateOrgUnitPrototypeForm.action?id=$orgUnitPrototype.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:removeOrgUnitPrototype( $orgUnitPrototype.id, '$!encoder.jsEncode( $orgUnitPrototype.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showOrgUnitPrototypeDetails( $orgUnitPrototype.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( "short_name" ):</label><br/><span id="shortNameField"></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 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototypeGroup.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototypeGroup.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/organisationUnitPrototypeGroup.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,69 @@
+<script type="text/javascript">
+ jQuery(document).ready(function(){
+ tableSorter( 'listTable' );
+ });
+
+ var i18n_confirm_delete = '$encoder.jsEscape($i18n.getString( "confirm_delete_orgunit_prototype_group" ) , "'")';
+ // Are you sure you want to delete this?
+ var i18n_adding_orgunit_prototype_group_failed = '$encoder.jsEscape($i18n.getString( "adding_orgunit_prototype_group_failed" ) , "'")';
+ var i18n_saving_orgunit_prototype_group_failed = '$encoder.jsEscape($i18n.getString( "saving_orgunit_prototype_group_failed" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "orgunit_prototype_group_management" ) #openHelp( "organisationUnitPrototypeGroup" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "orgUnitPrototypeGroup" )</td>
+ <td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrgUnitPrototypeGroupForm.action'" style="width:80px"/></td>
+ </tr>
+ </table>
+ <table class="listTable" id="listTable">
+ <col/>
+ <col width="120px"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $group in $organisationUnitPrototypeGroups )
+ <tr id="tr${group.id}">
+ <td onclick="showOrgUnitPrototypeGroupDetails( $group.id )">$encoder.htmlEncode( $group.displayName )</td>
+ <td style="text-align:right">
+ <a href="showUpdateOrgUnitPrototypeGroupForm.action?id=$group.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:translate( 'OrganisationUnitPrototypeGroup', '$group.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeOrgUnitPrototypeGroup( $group.id, '$encoder.jsEncode( $group.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showOrgUnitPrototypeGroupDetails( $group.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( "number_of_members" ):</label><br/><span id="memberCountField"></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 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgPrototypeForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgPrototypeForm.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgPrototypeForm.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,54 @@
+<script type="text/javascript">
+ jQuery(document).ready( function(){
+
+ validation2( 'updateOrgUnitPrototypeForm', function( form ){ form.submit(); },
+ {
+ 'rules': getValidationRules( "organisationUnitPrototype" )
+ } );
+
+ checkValueIsExist( "name", "validateOrgUnitPrototype.action", {id: $organisationUnitPrototype.id} );
+ });
+
+</script>
+
+<h3>$i18n.getString( "edit_constant" )</h3>
+
+<form id="updateOrgUnitPrototypeForm" action="updateOrgUnitPrototype.action" method="post" >
+<input type="hidden" id="id" name="id" value="$!organisationUnitPrototype.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( $!organisationUnitPrototype.name )" style="width:20em"/></td>
+ </tr>
+ <tr>
+ <td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="shortName" name="shortName" value="$!encoder.htmlEncode( $!organisationUnitPrototype.shortName )" style="width:20em"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='orgUnitPrototype.action'" style="width:10em"/></td>
+ </tr>
+</table>
+</form>
+
+<script type="text/javascript">
+
+validationRules = {
+
+ "organisationUnitPrototype" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 2, 160 ]
+ },
+ "shortName" : {
+ "required" : true,
+ "rangelength" : [ 2, 49 ]
+ }
+ }
+};
+</script>
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeGroupForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeGroupForm.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateOrgUnitPrototypeGroupForm.vm 2012-08-20 07:13:48 +0000
@@ -0,0 +1,90 @@
+<script type="text/javascript">
+ jQuery(function() {
+ validation2( 'updateOrgUnitPrototypeGroupForm', function( form )
+ {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function() {
+ beforeSubmit();
+ },
+ 'rules' : getValidationRules( "orgUnitPrototypeGroup" )
+ } );
+
+ checkValueIsExist( "name", "validateOrgUnitPrototypeGroup.action", {
+ id : getFieldValue( 'id' )
+ } );
+
+ jQuery("#availableList").dhisAjaxSelect({
+ source: "getOrgUnitPrototypes.action",
+ iterator: "orgUnitPrototypes",
+ connectedTo: 'groupMembers',
+ handler: function(item) {
+ var option = jQuery("<option data-id='" + item.groups + "' />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+ });
+</script>
+
+<h3>$i18n.getString( "edit_orgunit_prototype_group" )</h3>
+
+<form id="updateOrgUnitPrototypeGroupForm" action="updateOrgUnitPrototypeGroup.action" method="post" >
+
+<div>
+ <input type="hidden" id="id" name="id" value="$organisationUnitPrototypeGroup.id"/>
+</div>
+
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+
+ <tr>
+ <td style="width: 200px;"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td style="min-width: 240px;"><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $organisationUnitPrototypeGroup.name )" style="width:240px"/>
+ </td>
+ </tr>
+</table>
+
+<table>
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+
+ <tr>
+ <th>$i18n.getString( "available_data_elements" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+ #foreach( $orgUnitPrototype in $organisationUnitPrototypeGroup.members )
+ <option value="$orgUnitPrototype.id">$!encoder.htmlEncode( $orgUnitPrototype.displayName )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='orgUnitPrototypeGroup.action'" style="width:10em"/>
+</p>
+
+</form>
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm 2012-07-04 10:12:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm 2012-08-20 07:13:48 +0000
@@ -1,16 +1,28 @@
<h3>$i18n.getString( "administration" )</h3>
-<ul class="introList">
- #introListImgItem( "getConfiguration.action" "configuration" "systemsettings" )
- #introListImgItem( "listAllExportReport.action" "design_export_reports" "export" )
- #introListImgItem( "listAllImportReport.action" "design_import_reports" "import" )
- #introListImgItem( "openOptionComboAssociations.action" "define_categoryoptioncombo_associations" "dhis-web-maintenance-datadictionary" )
- #introListImgItem( "attributeValueGroupOrders.action" "attribute_group_order" "attribute_group_order" )
- #introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria" )
- #introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel" )
- #introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up" )
- <!--#introListImgItem( "jcharts.action" "chart" "jchart")-->
-</ul>
+<table cellspacing="0" cellpadding="0">
+<tr>
+ <td valign="top">
+ <ul class="introList" style="width:340px; margin-top:0px; margin-right:15px;">
+ #introListImgItem( "getConfiguration.action" "configuration" "systemsettings" )
+ #introListImgItem( "listAllExportReport.action" "design_export_reports" "export" )
+ #introListImgItem( "listAllImportReport.action" "design_import_reports" "import" )
+ #introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria" )
+ #introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel" )
+ #introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up" )
+ <!--#introListImgItem( "jcharts.action" "chart" "jchart")-->
+ </ul>
+ </td>
+
+ <td>
+ <ul class="introList" style="width:340px; margin-top:0px;">
+ #introListImgItem( "attributeValueGroupOrders.action" "attribute_group_order" "attribute_group_order" )
+ #introListImgItem( "openOptionComboAssociations.action" "define_categoryoptioncombo_associations" "dhis-web-maintenance-datadictionary" )
+ #introListImgItem( "orgUnitPrototype.action" "organisation_unit_prototype" "organisationUnit" )
+ #introListImgItem( "orgUnitPrototypeGroup.action" "organisation_unit_prototype_group" "organisationUnit" )
+ </ul>
+ </td>
+</tr>
<script>
function go(action){
window.location = action;