=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2011-11-03 01:02:13 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2011-12-09 19:08:49 +0000 @@ -26,8 +26,6 @@ import java.util.HashSet; import java.util.Set; -import org.hibernate.Criteria; -import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.attribute.Attribute; import org.hisp.dhis.attribute.AttributeStore; @@ -43,44 +41,24 @@ @SuppressWarnings( "unchecked" ) public Set getDataElementAttributes() { - Session session = sessionFactory.getCurrentSession(); - Criteria criteria = session.createCriteria( Attribute.class ); - criteria.add( Restrictions.eq( "dataElementAttribute", true ) ); - criteria.setCacheable( true ); - - return new HashSet( criteria.list() ); + return new HashSet( getCriteria( Restrictions.eq( "dataElementAttribute", true ) ).list() ); } @SuppressWarnings( "unchecked" ) public Set getIndicatorAttributes() { - Session session = sessionFactory.getCurrentSession(); - Criteria criteria = session.createCriteria( Attribute.class ); - criteria.add( Restrictions.eq( "indicatorAttribute", true ) ); - criteria.setCacheable( true ); - - return new HashSet( criteria.list() ); + return new HashSet( getCriteria( Restrictions.eq( "indicatorAttribute", true ) ).list() ); } @SuppressWarnings( "unchecked" ) public Set getOrganisationUnitAttributes() { - Session session = sessionFactory.getCurrentSession(); - Criteria criteria = session.createCriteria( Attribute.class ); - criteria.add( Restrictions.eq( "organisationUnitAttribute", true ) ); - criteria.setCacheable( true ); - - return new HashSet( criteria.list() ); + return new HashSet( getCriteria( Restrictions.eq( "organisationUnitAttribute", true ) ).list() ); } @SuppressWarnings( "unchecked" ) public Set getUserAttributes() { - Session session = sessionFactory.getCurrentSession(); - Criteria criteria = session.createCriteria( Attribute.class ); - criteria.add( Restrictions.eq( "userAttribute", true ) ); - criteria.setCacheable( true ); - - return new HashSet( criteria.list() ); + return new HashSet( getCriteria( Restrictions.eq( "userAttribute", true ) ).list() ); } }