dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25178
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12417: minor codestyle
------------------------------------------------------------
revno: 12417
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-03 14:00:36 +0200
message:
minor codestyle
modified:
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.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-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java 2013-09-13 11:51:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/hibernate/HibernateInterpretationStore.java 2013-10-03 12:00:36 +0000
@@ -28,43 +28,43 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.List;
-
import org.hibernate.Query;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.interpretation.Interpretation;
import org.hisp.dhis.interpretation.InterpretationStore;
import org.hisp.dhis.user.User;
+import java.util.List;
+
/**
* @author Lars Helge Overland
*/
public class HibernateInterpretationStore
extends HibernateIdentifiableObjectStore<Interpretation> implements InterpretationStore
-{
- @SuppressWarnings("unchecked")
+{
+ @SuppressWarnings( "unchecked" )
public List<Interpretation> getInterpretations( User user )
{
String hql = "select distinct i from Interpretation i left join i.comments c " +
"where i.user = :user or c.user = :user order by i.lastUpdated desc";
-
+
Query query = getQuery( hql );
query.setEntity( "user", user );
-
+
return query.list();
}
-
+
@SuppressWarnings("unchecked")
public List<Interpretation> getInterpretations( User user, int first, int max )
{
String hql = "select distinct i from Interpretation i left join i.comments c " +
"where i.user = :user or c.user = :user order by i.lastUpdated desc";
-
+
Query query = getQuery( hql );
query.setEntity( "user", user );
query.setMaxResults( first );
query.setMaxResults( max );
-
+
return query.list();
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java 2013-09-13 11:51:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java 2013-10-03 12:00:36 +0000
@@ -28,9 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-import java.util.List;
-
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.interpretation.Interpretation;
import org.hisp.dhis.interpretation.InterpretationComment;
@@ -42,6 +39,9 @@
import org.hisp.dhis.user.UserService;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Date;
+import java.util.List;
+
/**
* @author Lars Helge Overland
*/
@@ -59,21 +59,21 @@
{
this.interpretationStore = interpretationStore;
}
-
+
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
{
this.currentUserService = currentUserService;
}
-
+
private UserService userService;
public void setUserService( UserService userService )
{
this.userService = userService;
}
-
+
private PeriodService periodService;
public void setPeriodService( PeriodService periodService )
@@ -88,90 +88,90 @@
public int saveInterpretation( Interpretation interpretation )
{
User user = currentUserService.getCurrentUser();
-
+
if ( user != null )
{
interpretation.setUser( user );
}
-
+
if ( interpretation != null && interpretation.getPeriod() != null )
{
interpretation.setPeriod( periodService.reloadPeriod( interpretation.getPeriod() ) );
}
-
+
return interpretationStore.save( interpretation );
}
-
+
public Interpretation getInterpretation( int id )
{
return interpretationStore.get( id );
}
-
+
public Interpretation getInterpretation( String uid )
{
return interpretationStore.getByUid( uid );
}
-
+
public void updateInterpretation( Interpretation interpretation )
{
interpretationStore.update( interpretation );
}
-
+
public void deleteInterpretation( Interpretation interpretation )
{
interpretationStore.delete( interpretation );
}
-
+
public List<Interpretation> getInterpretations( int first, int max )
{
return interpretationStore.getAllOrderedLastUpdated( first, max );
}
-
+
public List<Interpretation> getInterpretations( User user, int first, int max )
{
return interpretationStore.getInterpretations( user, first, max );
}
-
+
public List<Interpretation> getInterpretations( User user )
{
return interpretationStore.getInterpretations( user );
}
-
+
public void addInterpretationComment( String uid, String text )
{
Interpretation interpretation = getInterpretation( uid );
User user = currentUserService.getCurrentUser();
-
+
InterpretationComment comment = new InterpretationComment( text );
comment.setLastUpdated( new Date() );
comment.setUid( CodeGenerator.generateCode() );
-
+
if ( user != null )
{
comment.setUser( user );
}
-
+
interpretation.addComment( comment );
-
+
interpretationStore.update( interpretation );
}
-
+
public void updateCurrentUserLastChecked()
{
User user = currentUserService.getCurrentUser();
-
+
user.setLastCheckedInterpretations( new Date() );
-
+
userService.updateUser( user );
}
-
+
public long getNewInterpretationCount()
{
User user = currentUserService.getCurrentUser();
-
+
long count = 0;
-
+
if ( user != null && user.getLastCheckedInterpretations() != null )
{
count = interpretationStore.getCountGeLastUpdated( user.getLastCheckedInterpretations() );
@@ -180,7 +180,7 @@
{
count = interpretationStore.getCount();
}
-
+
return count;
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-09-17 18:07:42 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-10-03 12:00:36 +0000
@@ -28,9 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.HashSet;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
@@ -57,6 +54,9 @@
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
+import java.util.HashSet;
+import java.util.List;
+
/**
* @author Lars Helge Overland
*/
@@ -126,14 +126,14 @@
/**
* Returns the current session.
- *
+ *
* @return the current session.
*/
protected final Session getSession()
{
return sessionFactory.getCurrentSession();
}
-
+
/**
* Creates a Query.
*
@@ -198,7 +198,7 @@
* @param expressions the Criterions for the Criteria.
* @return an object of the implementation Class type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
protected final T getObject( Criterion... expressions )
{
return (T) getCriteria( expressions ).uniqueResult();
@@ -210,7 +210,7 @@
* @param expressions the Criterions for the Criteria.
* @return a List with objects of the implementation Class type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
protected final List<T> getList( Criterion... expressions )
{
return getCriteria( expressions ).list();
@@ -282,7 +282,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final T get( int id )
{
T object = (T) sessionFactory.getCurrentSession().get( getClazz(), id );
@@ -297,7 +297,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final T load( int id )
{
T object = (T) sessionFactory.getCurrentSession().load( getClazz(), id );
@@ -325,7 +325,7 @@
}
@Override
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public final List<T> getAll()
{
Query query = sharingEnabled() ? getQueryAllAcl() : getQueryAll();