dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18272
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7642: Removed *exists methods
------------------------------------------------------------
revno: 7642
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-19 22:35:47 +0200
message:
Removed *exists methods
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.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/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2012-07-06 15:37:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2012-07-19 20:35:47 +0000
@@ -269,23 +269,6 @@
*/
Collection<DataElement> getDataElementsWithDataSets();
- /**
- * Checks whether a DataElement with the given identifier exists.
- *
- * @param id the DataElement identifier.
- * @return true or false.
- */
- boolean dataElementExists( int id );
-
- /**
- * Checks whether a DataElementCategoryOptionCombo with the given identifier
- * exists.
- *
- * @param id the DataElementCategoryOptionCombo identifier.
- * @return true or false.
- */
- boolean dataElementCategoryOptionComboExists( int id );
-
Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets );
Collection<DataElement> getDataElementsLikeName( String name );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2012-07-06 15:37:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2012-07-19 20:35:47 +0000
@@ -152,22 +152,6 @@
*/
Collection<DataElement> getDataElementsWithDataSets();
- /**
- * Checks whether a DataElement with the given identifier exists.
- *
- * @param id the DataElement identifier.
- * @return true or false.
- */
- boolean dataElementExists( int id );
-
- /**
- * Checks whether a DataElementCategoryOptionCombo with the given identifier exists.
- *
- * @param id the DataElementCategoryOptionCombo identifier.
- * @return true or false.
- */
- boolean dataElementCategoryOptionComboExists( int id );
-
Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets );
Map<Integer, Set<Integer>> getDataElementCategoryOptionCombos();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-07-06 15:37:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-07-19 20:35:47 +0000
@@ -299,16 +299,6 @@
return i18n( i18nService, dataElementStore.getDataElementsWithDataSets() );
}
- public boolean dataElementExists( int id )
- {
- return dataElementStore.dataElementExists( id );
- }
-
- public boolean dataElementCategoryOptionComboExists( int id )
- {
- return dataElementStore.dataElementCategoryOptionComboExists( id );
- }
-
public Collection<DataElement> getDataElementsLikeName( String name )
{
return getObjectsByName( i18nService, dataElementStore, name );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2012-07-06 15:37:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2012-07-19 20:35:47 +0000
@@ -223,20 +223,6 @@
return getQuery( hql ).setCacheable( true ).list();
}
- public boolean dataElementExists( int id )
- {
- final String sql = "select count(*) from dataelement where dataelementid=" + id;
-
- return statementManager.getHolder().queryForInteger( sql ) > 0;
- }
-
- public boolean dataElementCategoryOptionComboExists( int id )
- {
- final String sql = "select count(*) from categoryoptioncombo where categoryoptioncomboid=" + id;
-
- return statementManager.getHolder().queryForInteger( sql ) > 0;
- }
-
@SuppressWarnings( "unchecked" )
public Collection<DataElement> getDataElementsByDataSets( Collection<DataSet> dataSets )
{
=== 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 2012-06-27 05:36:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2012-07-19 20:35:47 +0000
@@ -355,12 +355,12 @@
return ID_NOT_NUMERIC;
}
- if ( !dataElementService.dataElementExists( operand.getDataElementId() ) )
+ if ( dataElementService.getDataElement( operand.getDataElementId() ) == null )
{
return DATAELEMENT_DOES_NOT_EXIST;
}
- if ( !operand.isTotal() && !dataElementService.dataElementCategoryOptionComboExists( operand.getOptionComboId() ) )
+ if ( !operand.isTotal() && categoryService.getDataElementCategoryOptionCombo( operand.getOptionComboId() ) == null )
{
return CATEGORYOPTIONCOMBO_DOES_NOT_EXIST;
}