dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35967
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18420: CriteriaQueryEngine, generics fixes
------------------------------------------------------------
revno: 18420
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-25 21:12:45 +0100
message:
CriteriaQueryEngine, generics fixes
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.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-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java 2015-02-23 11:17:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java 2015-02-25 20:12:45 +0000
@@ -28,6 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
@@ -39,12 +45,6 @@
import org.hisp.dhis.schema.Schema;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -66,7 +66,7 @@
return new ArrayList<>();
}
- HibernateGenericStore store = getStore( (Class<? extends IdentifiableObject>) schema.getKlass() );
+ HibernateGenericStore<?> store = getStore( (Class<? extends IdentifiableObject>) schema.getKlass() );
if ( store == null )
{
@@ -236,34 +236,33 @@
}
}
- private HibernateGenericStore getStore( Class<? extends IdentifiableObject> klass )
+ private HibernateGenericStore<?> getStore( Class<? extends IdentifiableObject> klass )
{
initStoreMap();
return stores.get( klass );
}
- @SuppressWarnings( "unchecked" )
- private <T> T getValue( Property property, Object objectValue )
+ private Object getValue( Property property, Object objectValue )
{
Class<?> klass = property.getKlass();
if ( !String.class.isInstance( objectValue ) )
{
- return (T) objectValue;
+ return objectValue;
}
String value = (String) objectValue;
if ( klass.isInstance( value ) )
{
- return (T) value;
+ return value;
}
if ( Boolean.class.isAssignableFrom( klass ) )
{
try
{
- return (T) Boolean.valueOf( value );
+ return Boolean.valueOf( value );
}
catch ( Exception ignored )
{
@@ -273,7 +272,7 @@
{
try
{
- return (T) Integer.valueOf( value );
+ return Integer.valueOf( value );
}
catch ( Exception ignored )
{
@@ -283,7 +282,7 @@
{
try
{
- return (T) Float.valueOf( value );
+ return Float.valueOf( value );
}
catch ( Exception ignored )
{
@@ -293,7 +292,7 @@
{
try
{
- return (T) Double.valueOf( value );
+ return Double.valueOf( value );
}
catch ( Exception ignored )
{
@@ -303,7 +302,7 @@
{
try
{
- return (T) DateUtils.parseDate( value,
+ return DateUtils.parseDate( value,
"yyyy-MM-dd'T'HH:mm:ssZ",
"yyyy-MM-dd'T'HH:mm:ss",
"yyyy-MM-dd'T'HH:mm",