← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5845: Removed unused code

 

------------------------------------------------------------
revno: 5845
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-01 13:16:49 +0100
message:
  Removed unused code
removed:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/DefaultSequenceGenerator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/Sequence.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/SequenceGenerator.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate/Sequence.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence/
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence/SequenceGeneratorTest.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/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-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/DefaultSequenceGenerator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/DefaultSequenceGenerator.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/DefaultSequenceGenerator.java	1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package org.hisp.dhis.sequence;
-
-/*
- * 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.Iterator;
-
-import org.hisp.dhis.common.GenericStore;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-public class DefaultSequenceGenerator
-    implements SequenceGenerator
-{
-    private GenericStore<Sequence> sequenceStore;
-    
-    public void setSequenceStore( GenericStore<Sequence> sequenceStore )
-    {
-        this.sequenceStore = sequenceStore;
-    }
-    
-    @Transactional(propagation=Propagation.REQUIRES_NEW)
-    public int getNextValue()
-    {
-        Iterator<Sequence> sequences = sequenceStore.getAll().iterator();
-        
-        if ( sequences.hasNext() )
-        {
-            Sequence sequence = sequences.next();
-            sequenceStore.update( sequence.increment() );
-            return sequence.getCurrentValue();
-        }
-        else
-        {
-            sequenceStore.save( new Sequence( BASE_VALUE ) );
-            return BASE_VALUE;
-        }
-    }
-}

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/Sequence.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/Sequence.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/Sequence.java	1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
-package org.hisp.dhis.sequence;
-
-/*
- * 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.
- */
-
-public class Sequence
-{
-    private int id;
-    
-    private int currentValue;
-
-    public Sequence()
-    {
-    }
-    
-    public Sequence( int currentValue )
-    {
-        this.currentValue = currentValue;
-    }
-    
-    public Sequence increment()
-    {
-        ++currentValue;
-        return this;
-    }
-    
-    public int getId()
-    {
-        return id;
-    }
-
-    public void setId( int id )
-    {
-        this.id = id;
-    }
-
-    public int getCurrentValue()
-    {
-        return currentValue;
-    }
-
-    public void setCurrentValue( int currentValue )
-    {
-        this.currentValue = currentValue;
-    }
-}

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/SequenceGenerator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/SequenceGenerator.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sequence/SequenceGenerator.java	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-package org.hisp.dhis.sequence;
-
-/*
- * 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.
- */
-
-public interface SequenceGenerator
-{
-    final int BASE_VALUE = 1;
-    
-    /**
-     * Returns the next value in the sequence. The value is guaranteed to be 
-     * unique in a system scope. This method will create a new physical transaction
-     * which will be committed when the method returns to avoid a race condition
-     * with other write transactions.
-     */
-    int getNextValue();
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-01-25 10:30:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-02-01 12:16:49 +0000
@@ -91,6 +91,7 @@
         executeSql( "DROP TABLE dashboardcontent_olapurls" );
         executeSql( "DROP TABLE olapurl" );
         executeSql( "DROP TABLE calculateddataelement" );
+        executeSql( "DROP TABLE systemsequence" );        
         executeSql( "ALTER TABLE dataelementcategoryoption drop column categoryid" );
         executeSql( "ALTER TABLE reporttable DROP column dimension_type" );
         executeSql( "ALTER TABLE reporttable DROP column dimensiontype" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-01-27 11:40:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-02-01 12:16:49 +0000
@@ -224,11 +224,6 @@
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
-  <bean id="org.hisp.dhis.sequence.SequenceStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
-    <property name="sessionFactory" ref="sessionFactory" />
-    <property name="clazz" value="org.hisp.dhis.sequence.Sequence" />
-  </bean>
-
   <bean id="org.hisp.dhis.configuration.ConfigurationStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="clazz" value="org.hisp.dhis.configuration.Configuration" />
@@ -468,10 +463,6 @@
     <property name="conceptStore" ref="org.hisp.dhis.concept.ConceptStore" />
   </bean>
 
-  <bean id="org.hisp.dhis.sequence.SequenceGenerator" class="org.hisp.dhis.sequence.DefaultSequenceGenerator">
-    <property name="sequenceStore" ref="org.hisp.dhis.sequence.SequenceStore" />
-  </bean>
-
   <bean id="org.hisp.dhis.configuration.ConfigurationService" class="org.hisp.dhis.configuration.DefaultConfigurationService">
     <property name="configurationStore" ref="org.hisp.dhis.configuration.ConfigurationStore" />
   </bean>

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate/Sequence.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate/Sequence.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sequence/hibernate/Sequence.hbm.xml	1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-<?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";>
-
-<hibernate-mapping>
-  <class name="org.hisp.dhis.sequence.Sequence" table="systemsequence">
-
-    <id name="id" column="systemsequenceid">
-      <generator class="native" />
-    </id>
-
-    <property name="currentValue" not-null="true" />
-
-  </class>
-</hibernate-mapping>

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence/SequenceGeneratorTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence/SequenceGeneratorTest.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/sequence/SequenceGeneratorTest.java	1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-package org.hisp.dhis.sequence;
-
-/*
- * 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 junit.framework.Assert.assertEquals;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.junit.Test;
-
-public class SequenceGeneratorTest
-    extends DhisSpringTest
-{
-    private SequenceGenerator generator;
-
-    @Override
-    public void setUpTest()
-    {
-        generator = (SequenceGenerator) getBean( SequenceGenerator.class.getName() );
-    }
-    
-    @Test
-    public void testGetNextValue()
-    {
-        assertEquals( SequenceGenerator.BASE_VALUE, generator.getNextValue() );
-        assertEquals( SequenceGenerator.BASE_VALUE + 1, generator.getNextValue() );
-        assertEquals( SequenceGenerator.BASE_VALUE + 2, generator.getNextValue() );
-        assertEquals( SequenceGenerator.BASE_VALUE + 3, generator.getNextValue() );
-    }
-}