dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39550
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20025: Removed unusued methods
------------------------------------------------------------
revno: 20025
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-07 14:10:27 +0200
message:
Removed unusued methods
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2015-09-04 08:57:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2015-09-07 12:10:27 +0000
@@ -156,28 +156,4 @@
* {@link ProgramIndicator.INVALID_VARIABLES_IN_EXPRESSION}.
*/
String filterIsValid( String filter );
-
- /**
- * Get all {@link ProgramStageDataElement} part of the expression.
- *
- * @param expression the expression.
- * @return a set of ProgramStageDataElements.
- */
- Set<ProgramStageDataElement> getProgramStageDataElementsInExpression( String expression );
-
- /**
- * Get all {@link TrackedEntityAttribute} part of the expression.
- *
- * @param expression the expression.
- * @return a set of TrackedEntityAttributes.
- */
- Set<TrackedEntityAttribute> getAttributesInExpression( String expression );
-
- /**
- * Get all {@link Constant} part of the expression of the expression.
- *
- * @param expression the expression.
- * @return a set of Constants.
- */
- Set<Constant> getConstantsInExpression( String expression );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-06-18 06:57:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-09-07 12:10:27 +0000
@@ -887,7 +887,7 @@
int matchCount = 0;
int valueCount = 0;
-
+
while ( matcher.find() )
{
matchCount++;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-09-07 10:45:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-09-07 12:10:27 +0000
@@ -28,7 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.ImmutableMap;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.ValueType;
@@ -43,7 +50,6 @@
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.i18n.I18nService;
@@ -59,15 +65,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
+import com.google.common.collect.ImmutableMap;
/**
* @author Chau Thu Tran
@@ -658,77 +656,6 @@
return expr.toString();
}
- @Override
- @Transactional
- public Set<ProgramStageDataElement> getProgramStageDataElementsInExpression( String expression )
- {
- Set<ProgramStageDataElement> elements = new HashSet<>();
-
- Matcher matcher = ProgramIndicator.DATAELEMENT_PATTERN.matcher( expression );
-
- while ( matcher.find() )
- {
- String ps = matcher.group( 1 );
- String de = matcher.group( 2 );
-
- ProgramStage programStage = programStageService.getProgramStage( ps );
- DataElement dataElement = dataElementService.getDataElement( de );
-
- if ( programStage != null && dataElement != null )
- {
- elements.add( new ProgramStageDataElement( programStage, dataElement ) );
- }
- }
-
- return elements;
- }
-
- @Override
- @Transactional
- public Set<TrackedEntityAttribute> getAttributesInExpression( String expression )
- {
- Set<TrackedEntityAttribute> attributes = new HashSet<>();
-
- Matcher matcher = ProgramIndicator.ATTRIBUTE_PATTERN.matcher( expression );
-
- while ( matcher.find() )
- {
- String at = matcher.group( 1 );
-
- TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( at );
-
- if ( attribute != null )
- {
- attributes.add( attribute );
- }
- }
-
- return attributes;
- }
-
- @Override
- @Transactional
- public Set<Constant> getConstantsInExpression( String expression )
- {
- Set<Constant> constants = new HashSet<>();
-
- Matcher matcher = ExpressionService.CONSTANT_PATTERN.matcher( expression );
-
- while ( matcher.find() )
- {
- String co = matcher.group( 1 );
-
- Constant constant = constantService.getConstant( co );
-
- if ( constant != null )
- {
- constants.add( constant );
- }
- }
-
- return constants;
- }
-
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java 2015-09-07 11:47:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java 2015-09-07 12:10:27 +0000
@@ -28,6 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.program.ProgramIndicator.KEY_ATTRIBUTE;
+import static org.hisp.dhis.program.ProgramIndicator.KEY_CONSTANT;
+import static org.hisp.dhis.program.ProgramIndicator.KEY_DATAELEMENT;
+import static org.hisp.dhis.program.ProgramIndicator.KEY_PROGRAM_VARIABLE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.ValueType;
import org.hisp.dhis.constant.Constant;
@@ -49,14 +63,6 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static org.hisp.dhis.program.ProgramIndicator.*;
-import static org.junit.Assert.*;
-
/**
* @author Chau Thu Tran
*/
@@ -414,28 +420,6 @@
// -------------------------------------------------------------------------
@Test
- public void testGetProgramStageDataElementsInExpression()
- {
- Set<ProgramStageDataElement> elements = programIndicatorService
- .getProgramStageDataElementsInExpression( indicatorE.getExpression() );
-
- assertEquals( 2, elements.size() );
-
- assertTrue( elements.contains( new ProgramStageDataElement( psA, deA ) ) );
- assertTrue( elements.contains( new ProgramStageDataElement( psB, deA ) ) );
- }
-
- @Test
- public void testGetAttributesInExpression()
- {
- Set<TrackedEntityAttribute> attributes = programIndicatorService.getAttributesInExpression( indicatorE.getExpression() );
-
- assertEquals( 2, attributes.size() );
- assertTrue( attributes.contains( atA ) );
- assertTrue( attributes.contains( atB ) );
- }
-
- @Test
public void testGetProgramIndicatorValue()
{
programIndicatorService.addProgramIndicator( indicatorB );