dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08472
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2035: Removed the DataElementOrderManager
------------------------------------------------------------
revno: 2035
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-11-11 18:36:25 +0100
message:
Removed the DataElementOrderManager
removed:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/DataElementOrder.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManagerException.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DefaultDataElementOrderManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStore.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStoreException.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/FileDataElementOrderStore.java
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order'
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/DataElementOrder.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/DataElementOrder.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/DataElementOrder.java 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-package org.hisp.dhis.order;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataElementOrder.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class DataElementOrder
-{
- private int dataSetId;
-
- private List<Integer> order;
-
- // -------------------------------------------------------------------------
- // Getters and setters
- // -------------------------------------------------------------------------
-
- public void setOrder( List<Integer> order )
- {
- this.order = order;
- }
-
- public List<Integer> getOrder()
- {
- return order;
- }
-
- public int getDataSetId()
- {
- return dataSetId;
- }
-
- public void setDataSetId( int dataSetId )
- {
- this.dataSetId = dataSetId;
- }
-}
=== removed directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager'
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManager.java 1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
-package org.hisp.dhis.order.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataset.DataSet;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataElementOrderManager.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public interface DataElementOrderManager
-{
- String ID = DataElementOrderManager.class.getName();
-
- List<DataElement> getOrderedDataElements( DataSet dataSet )
- throws DataElementOrderManagerException;
-
- void setDataElementOrder( DataSet dataSet, List<Integer> dataElementIds )
- throws DataElementOrderManagerException;
-
- void setDataElementOrder( DataSet dataSet, Comparator<DataElement> comparator )
- throws DataElementOrderManagerException;
-
- void moveDataElementUp( DataSet dataSet, Integer dataElementId )
- throws DataElementOrderManagerException;
-
- void moveDataElementDown( DataSet dataSet, Integer dataElementId )
- throws DataElementOrderManagerException;
-
- void resetDataElementOrder( DataSet dataSet )
- throws DataElementOrderManagerException;
-
- Comparator<DataElement> getDefaultComparator()
- throws DataElementOrderManagerException;
-
- Collection<Comparator<DataElement>> getAvailableComparators()
- throws DataElementOrderManagerException;
-}
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManagerException.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManagerException.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DataElementOrderManagerException.java 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.order.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataElementOrderManagerException.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class DataElementOrderManagerException
- extends Exception
-{
- public DataElementOrderManagerException( String message )
- {
- super( message );
- }
-
- public DataElementOrderManagerException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DefaultDataElementOrderManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DefaultDataElementOrderManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/manager/DefaultDataElementOrderManager.java 1970-01-01 00:00:00 +0000
@@ -1,309 +0,0 @@
-package org.hisp.dhis.order.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.order.DataElementOrder;
-import org.hisp.dhis.order.store.DataElementOrderStore;
-import org.hisp.dhis.order.store.DataElementOrderStoreException;
-import org.hisp.dhis.util.CollectionUtils;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DefaultDataElementOrderManager.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class DefaultDataElementOrderManager
- implements DataElementOrderManager
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataElementOrderStore dataElementOrderStore;
-
- public void setDataElementOrderStore( DataElementOrderStore dataElementOrderStore )
- {
- this.dataElementOrderStore = dataElementOrderStore;
- }
-
- // -------------------------------------------------------------------------
- // Configuration
- // -------------------------------------------------------------------------
-
- private Comparator<DataElement> defaultComparator;
-
- public void setDefaultComparator( Comparator<DataElement> defaultComparator )
- {
- this.defaultComparator = defaultComparator;
- }
-
- private Collection<Comparator<DataElement>> availableComparators;
-
- public void setAvailableComparators( Collection<Comparator<DataElement>> availableComparators )
- {
- this.availableComparators = availableComparators;
- }
-
- // -------------------------------------------------------------------------
- // DataElementOrderManager implementation
- // -------------------------------------------------------------------------
-
- public Comparator<DataElement> getDefaultComparator()
- throws DataElementOrderManagerException
- {
- return defaultComparator;
- }
-
- public Collection<Comparator<DataElement>> getAvailableComparators()
- throws DataElementOrderManagerException
- {
- return availableComparators;
- }
-
- public List<DataElement> getOrderedDataElements( DataSet dataSet )
- throws DataElementOrderManagerException
- {
- DataElementOrder dataElementOrder = null;
-
- // ---------------------------------------------------------------------
- // Search the data set for stored order
- // ---------------------------------------------------------------------
-
- try
- {
- dataElementOrder = dataElementOrderStore.getDataElementOrder( dataSet );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to get data element order", e );
- }
-
- // ---------------------------------------------------------------------
- // No stored order, use default
- // ---------------------------------------------------------------------
-
- if ( dataElementOrder == null )
- {
- List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
- Collections.sort( dataElements, getDefaultComparator() );
-
- return dataElements;
- }
-
- // ---------------------------------------------------------------------
- // Stored order
- // ---------------------------------------------------------------------
-
- else
- {
- Map<Integer, DataElement> idMap;
-
- try
- {
- idMap = CollectionUtils.createMap( dataSet.getDataElements(), "getId" );
- }
- catch ( Exception e )
- {
- throw new DataElementOrderManagerException( "Failed to create id map", e );
- }
-
- // -----------------------------------------------------------------
- // Order according to the stored order
- // -----------------------------------------------------------------
-
- List<DataElement> result = new ArrayList<DataElement>( idMap.size() );
-
- for ( Integer id : dataElementOrder.getOrder() )
- {
- if ( idMap.containsKey( id ) )
- {
- result.add( idMap.get( id ) );
-
- idMap.remove( id );
- }
- }
-
- // -----------------------------------------------------------------
- // Order remaining data elements by default order
- // -----------------------------------------------------------------
-
- List<DataElement> remainingDataElements = new ArrayList<DataElement>( idMap.values() );
-
- Collections.sort( remainingDataElements, getDefaultComparator() );
-
- result.addAll( remainingDataElements );
-
- return result;
- }
- }
-
- public void setDataElementOrder( DataSet dataSet, List<Integer> dataElementIds )
- throws DataElementOrderManagerException
- {
- DataElementOrder dataElementOrder;
-
- try
- {
- dataElementOrder = dataElementOrderStore.getDataElementOrder( dataSet );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to get data element order", e );
- }
-
- if ( dataElementOrder == null )
- {
- dataElementOrder = new DataElementOrder();
- dataElementOrder.setDataSetId( dataSet.getId() );
- dataElementOrder.setOrder( dataElementIds );
-
- try
- {
- dataElementOrderStore.addDataElementOrder( dataElementOrder );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to add data element order", e );
- }
- }
- else
- {
- dataElementOrder.setOrder( dataElementIds );
-
- try
- {
- dataElementOrderStore.updateDataElementOrder( dataElementOrder );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to update data element order", e );
- }
- }
- }
-
- public void setDataElementOrder( DataSet dataSet, Comparator<DataElement> comparator )
- throws DataElementOrderManagerException
- {
- List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
- Collections.sort( dataElements, comparator );
-
- setDataElementOrder( dataSet, getIdList( dataElements ) );
- }
-
- public void moveDataElementUp( DataSet dataSet, Integer dataElementId )
- throws DataElementOrderManagerException
- {
- List<DataElement> list = getOrderedDataElements( dataSet );
-
- List<Integer> idList = getIdList( list );
-
- int index = idList.indexOf( dataElementId );
-
- if ( index > 0 )
- {
- Integer tmp = idList.get( index - 1 );
- idList.set( index - 1, dataElementId );
- idList.set( index, tmp );
- }
-
- setDataElementOrder( dataSet, idList );
- }
-
- public void moveDataElementDown( DataSet dataSet, Integer dataElementId )
- throws DataElementOrderManagerException
- {
- List<DataElement> list = getOrderedDataElements( dataSet );
-
- List<Integer> idList = getIdList( list );
-
- int index = idList.indexOf( dataElementId );
-
- if ( index < idList.size() - 1 )
- {
- Integer tmp = idList.get( index + 1 );
- idList.set( index + 1, dataElementId );
- idList.set( index, tmp );
- }
-
- setDataElementOrder( dataSet, idList );
- }
-
- public void resetDataElementOrder( DataSet dataSet )
- throws DataElementOrderManagerException
- {
- DataElementOrder dataElementOrder;
-
- try
- {
- dataElementOrder = dataElementOrderStore.getDataElementOrder( dataSet );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to get data element order", e );
- }
-
- if ( dataElementOrder != null )
- {
- try
- {
- dataElementOrderStore.deleteDataElementOrder( dataElementOrder );
- }
- catch ( DataElementOrderStoreException e )
- {
- throw new DataElementOrderManagerException( "Failed to delete data element order", e );
- }
- }
- }
-
- // -------------------------------------------------------------------------
- // Support methods
- // -------------------------------------------------------------------------
-
- private List<Integer> getIdList( List<DataElement> dataElements )
- throws DataElementOrderManagerException
- {
- try
- {
- return CollectionUtils.createList( dataElements, "getId" );
- }
- catch ( Exception e )
- {
- throw new DataElementOrderManagerException( "Failed to create id list", e );
- }
- }
-}
=== removed directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store'
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStore.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStore.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStore.java 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-package org.hisp.dhis.order.store;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.order.DataElementOrder;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataElementOrderStore.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public interface DataElementOrderStore
-{
- String ID = DataElementOrderStore.class.getName();
-
- void addDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException;
-
- void updateDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException;
-
- DataElementOrder getDataElementOrder( DataSet dataSet ) throws DataElementOrderStoreException;
-
- void deleteDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException;
-}
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStoreException.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStoreException.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/DataElementOrderStoreException.java 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.order.store;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataElementOrderStoreException.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class DataElementOrderStoreException
- extends Exception
-{
- public DataElementOrderStoreException( String message )
- {
- super( message );
- }
-
- public DataElementOrderStoreException( String message, Throwable cause )
- {
- super( message, cause );
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/FileDataElementOrderStore.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/FileDataElementOrderStore.java 2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/order/store/FileDataElementOrderStore.java 1970-01-01 00:00:00 +0000
@@ -1,202 +0,0 @@
-package org.hisp.dhis.order.store;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.external.location.LocationManager;
-import org.hisp.dhis.external.location.LocationManagerException;
-import org.hisp.dhis.order.DataElementOrder;
-
-import com.thoughtworks.xstream.XStream;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: FileDataElementOrderStore.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class FileDataElementOrderStore
- implements DataElementOrderStore
-{
- private static final String ALIAS_DATAELEMENTORDER = "dataElementOrder";
-
- private static final String DIR = "de";
- private static final String FILE_NAME = "dataElementOrder.xml";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private LocationManager locationManager;
-
- public void setLocationManager( LocationManager locationManager )
- {
- this.locationManager = locationManager;
- }
-
- // -------------------------------------------------------------------------
- // DataElementOrderStore implementation
- // -------------------------------------------------------------------------
-
- public void addDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException
- {
- Map<String, DataElementOrder> orderMap = loadOrderMap();
-
- orderMap.put( getUniqueKey( dataElementOrder ), dataElementOrder );
-
- saveOrderMap( orderMap );
- }
-
- public void updateDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException
- {
- addDataElementOrder( dataElementOrder );
- }
-
- public DataElementOrder getDataElementOrder( DataSet dataSet ) throws DataElementOrderStoreException
- {
- Map<String, DataElementOrder> orderMap = loadOrderMap();
-
- DataElementOrder dataElementOrder = orderMap.get( getUniqueKey( dataSet ) );
-
- return dataElementOrder;
- }
-
- public void deleteDataElementOrder( DataElementOrder dataElementOrder ) throws DataElementOrderStoreException
- {
- Map<String, DataElementOrder> orderMap = loadOrderMap();
-
- orderMap.remove( getUniqueKey( dataElementOrder ) );
-
- saveOrderMap( orderMap );
- }
-
- // -------------------------------------------------------------------------
- // File access methods
- // -------------------------------------------------------------------------
-
- @SuppressWarnings("unchecked")
- private Map<String, DataElementOrder> loadOrderMap() throws DataElementOrderStoreException
- {
- Reader reader;
-
- try
- {
- File targetFile = locationManager.getFileForReading( FILE_NAME, DIR );
-
- reader = new BufferedReader( new FileReader( targetFile ) );
- }
- catch ( LocationManagerException ex )
- {
- return new HashMap<String, DataElementOrder>();
- }
- catch ( FileNotFoundException ex )
- {
- return new HashMap<String, DataElementOrder>();
- }
-
- XStream xStream = getXStream();
-
- Map<String, DataElementOrder> orderMap = (Map<String, DataElementOrder>) xStream.fromXML( reader );
-
- try
- {
- reader.close();
- }
- catch ( IOException e )
- {
- throw new DataElementOrderStoreException( "Failed to close writer", e );
- }
-
- return orderMap;
- }
-
- private void saveOrderMap( Map<String, DataElementOrder> orderMap ) throws DataElementOrderStoreException
- {
- Writer writer;
-
- try
- {
- File targetFile = locationManager.getFileForWriting( FILE_NAME, DIR );
-
- writer = new BufferedWriter( new FileWriter( targetFile ) );
- }
- catch ( LocationManagerException ex )
- {
- throw new DataElementOrderStoreException( "Failed to get target file for reading", ex );
- }
- catch ( IOException ex )
- {
- throw new DataElementOrderStoreException( "Failed to create writer for target file", ex );
- }
-
- XStream xStream = getXStream();
- xStream.toXML( orderMap, writer );
-
- try
- {
- writer.close();
- }
- catch ( IOException e )
- {
- throw new DataElementOrderStoreException( "Failed to close writer", e );
- }
- }
-
- private XStream getXStream()
- {
- XStream xStream = new XStream();
-
- xStream.alias( ALIAS_DATAELEMENTORDER, DataElementOrder.class );
-
- return xStream;
- }
-
- // -------------------------------------------------------------------------
- // These methods return the same key based on different sources
- // -------------------------------------------------------------------------
-
- private static String getUniqueKey( DataElementOrder dataElementOrder )
- {
- return String.valueOf( dataElementOrder.getDataSetId() );
- }
-
- private static String getUniqueKey( DataSet dataSet )
- {
- return String.valueOf( dataSet.getId() );
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 17:36:25 +0000
@@ -569,31 +569,6 @@
</property>
</bean>
- <!-- DataElement Order -->
-
- <bean id="org.hisp.dhis.order.store.DataElementOrderStore" class="org.hisp.dhis.order.store.FileDataElementOrderStore">
- <property name="locationManager" ref="locationManager"/>
- </bean>
-
- <bean id="org.hisp.dhis.order.manager.DataElementOrderManager"
- class="org.hisp.dhis.order.manager.DefaultDataElementOrderManager">
- <property name="dataElementOrderStore">
- <ref local="org.hisp.dhis.order.store.DataElementOrderStore" />
- </property>
- <property name="defaultComparator">
- <bean class="org.hisp.dhis.util.comparator.DataElementIdComparator" />
- </property>
- <property name="availableComparators">
- <set>
- <bean class="org.hisp.dhis.util.comparator.DataElementIdComparator" />
- <bean
- class="org.hisp.dhis.dataelement.comparator.DataElementNameComparator" />
- <bean
- class="org.hisp.dhis.dataelement.comparator.DataElementCodeComparator" />
- </set>
- </property>
- </bean>
-
<!-- About -->
<bean id="org.hisp.dhis.about.action.AboutAction" class="org.hisp.dhis.about.action.AboutAction" scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 2010-11-11 17:36:25 +0000
@@ -55,7 +55,6 @@
import org.hisp.dhis.minmax.MinMaxDataElementService;
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
-import org.hisp.dhis.order.manager.DataElementOrderManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -91,13 +90,6 @@
this.systemSettingManager = systemSettingManager;
}
- private DataElementOrderManager dataElementOrderManager;
-
- public void setDataElementOrderManager( DataElementOrderManager dataElementOrderManager )
- {
- this.dataElementOrderManager = dataElementOrderManager;
- }
-
private DataValueService dataValueService;
public void setDataValueService( DataValueService dataValueService )
@@ -396,12 +388,6 @@
i18n, dataSet );
}
- // ---------------------------------------------------------------------
- // Working on the display of dataelements
- // ---------------------------------------------------------------------
-
- orderedDataElements = dataElementOrderManager.getOrderedDataElements( dataSet );
-
displayPropertyHandler.handle( orderedDataElements );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 17:25:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 17:36:25 +0000
@@ -72,8 +72,6 @@
<bean id="org.hisp.dhis.de.action.FormAction" class="org.hisp.dhis.de.action.FormAction"
scope="prototype">
<property name="dataSetLockService" ref="org.hisp.dhis.datalock.DataSetLockService" />
- <property name="dataElementOrderManager"
- ref="org.hisp.dhis.order.manager.DataElementOrderManager" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
<property name="standardCommentsManager"
ref="org.hisp.dhis.de.comments.StandardCommentsManager" />