dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30800
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15656: Removed new methods for querying TEIs. All TEI queries should go through the existing getTrackedE...
------------------------------------------------------------
revno: 15656
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-12 18:30:25 +0200
message:
Removed new methods for querying TEIs. All TEI queries should go through the existing getTrackedEntityInstances method.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/AddUserGroupAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml
--
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/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-06-11 13:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-06-12 16:30:25 +0000
@@ -38,7 +38,6 @@
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
import org.hisp.dhis.event.EventStatus;
import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStatus;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
@@ -246,30 +245,4 @@
* @return ValidationCriteria object which is violated
*/
ValidationCriteria validateEnrollment( TrackedEntityInstance entityInstance, Program program, I18nFormat format );
-
- /**
- * Search tracked entity instances by a certain attribute- value
- *
- * @param orgunit OrganisationUnit
- * @param attributeValue Attribute value
- * @param program Program
- * @param min First result
- * @param max Maximum results
- *
- * @return TrackedEntityInstance list
- */
- Collection<TrackedEntityInstance> searchTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program, Integer min , Integer max);
-
- /**
- * Get the number of tracked entity instances who has a certain attribute-value
- *
- * @param orgunit OrganisationUnit
- * @param attributeValue Attribute value
- * @param program Program
- * @param min First result
- * @param max Maximum results
- *
- * @return The number of TEIs
- */
- int countTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-06-11 13:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-06-12 16:30:25 +0000
@@ -28,12 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
@@ -61,19 +59,4 @@
* @return
*/
String validate( TrackedEntityInstance instance, TrackedEntityAttributeValue attributeValue, Program program );
-
- /**
- * Search tracked entity instances by a certain attribute- value
- *
- * @param orgunit OrganisationUnit
- * @param attributeValue Attribute value
- * @param min First result
- * @param max Maximum results
- *
- * @return TrackedEntityInstance list
- */
- Collection<TrackedEntityInstance> searchTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program,
- Integer min, Integer max );
-
- int countTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program );
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java 2014-06-03 09:14:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java 2014-06-12 16:30:25 +0000
@@ -28,6 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
@@ -35,14 +42,6 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.scheduling.TaskId;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
public interface DataValueSetService
{
void writeDataValueSet( String dataSet, String period, String orgUnit, OutputStream out );
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-06-11 13:14:42 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-06-12 16:30:25 +0000
@@ -672,19 +672,4 @@
return null;
}
-
- @Override
- public Collection<TrackedEntityInstance> searchTrackedEntityByAttribute( OrganisationUnit orgunit,
- String attributeValue, Program program, Integer min, Integer max )
- {
- return trackedEntityInstanceStore.searchTrackedEntityByAttribute(orgunit, attributeValue, program, min, max);
- }
-
- @Override
- public int countTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program )
- {
- return trackedEntityInstanceStore.countTrackedEntityByAttribute( orgunit, attributeValue, program );
- }
-
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-06-11 15:36:16 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-06-12 16:30:25 +0000
@@ -45,15 +45,12 @@
import static org.hisp.dhis.trackedentity.TrackedEntityInstanceService.SEPARATOR;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
-import org.hibernate.criterion.CriteriaSpecification;
-import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
@@ -435,52 +432,4 @@
return null;
}
-
-
- @SuppressWarnings( "unchecked" )
- @Override
- public Collection<TrackedEntityInstance> searchTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program, Integer min , Integer max )
- {
- Criteria criteria = getCriteria();
- criteria.createAlias( "attributeValues", "attributeValue" );
- criteria.add( Restrictions.ilike( "attributeValue.value", "%" + attributeValue + "%" ) );
- criteria.add( Restrictions.eq( "organisationUnit", orgunit ) );
-
- if( program!= null)
- {
- criteria.createAlias( "programInstances", "programInstance" );
- criteria.createAlias( "programInstance.program", "program" );
- criteria.add( Restrictions.eq( "program", program ) );
- }
-
- if( min!= null && max != null )
- {
- criteria.setFirstResult( min );
- criteria.setMaxResults( max );
- }
- criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
- criteria.addOrder( Order.asc( "lastUpdated" ));
-
- return criteria.list();
- }
-
- @Override
- public int countTrackedEntityByAttribute( OrganisationUnit orgunit, String attributeValue, Program program )
- {
- Criteria criteria = getCriteria();
- criteria.createAlias( "attributeValues", "attributeValue" );
- criteria.add( Restrictions.eq( "organisationUnit", orgunit ) );
-
- if( program!= null)
- {
- criteria.createAlias( "programInstances", "programInstance" );
- criteria.createAlias( "programInstance.program", "program" );
- criteria.add( Restrictions.eq( "program", program ) );
- }
-
- criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
- Number rs = (Number) criteria.setProjection(Projections.rowCount()).uniqueResult();
-
- return ( rs != null && rs.intValue() > 0 ) ? rs.intValue() : 0;
- }
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java 2014-06-11 13:14:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java 2014-06-12 16:30:25 +0000
@@ -33,7 +33,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
@@ -44,8 +43,6 @@
import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderInListNoProgramComparator;
import org.springframework.beans.factory.annotation.Autowired;
-import com.opensymphony.xwork2.Action;
-
/**
* @author Chau Thu Tran
*
@@ -143,11 +140,13 @@
Collections.sort( attributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() );
}
+ /* TODO use the TEI query interface
total = entityInstanceService.countTrackedEntityByAttribute( orgunit, attributeValue, program );
this.paging = createPaging( total );
entityInstances = new ArrayList<TrackedEntityInstance>( entityInstanceService.searchTrackedEntityByAttribute(
orgunit, attributeValue, program, paging.getStartPos(), paging.getPageSize() ) );
+ */
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/AddUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/AddUserGroupAction.java 2014-05-28 16:38:44 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/AddUserGroupAction.java 2014-06-12 16:30:25 +0000
@@ -28,11 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_ONLY_MANAGE_WITHIN_USER_GROUPS;
+
import java.util.List;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.hibernate.exception.CreateAccessDeniedException;
-import org.hisp.dhis.security.SecurityService;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.User;
@@ -42,8 +43,6 @@
import com.opensymphony.xwork2.Action;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_ONLY_MANAGE_WITHIN_USER_GROUPS;
-
public class AddUserGroupAction
implements Action
{
@@ -79,13 +78,6 @@
this.systemSettingManager = systemSettingManager;
}
- private SecurityService securityService;
-
- public void setSecurityService( SecurityService securityService )
- {
- this.securityService = securityService;
- }
-
// -------------------------------------------------------------------------
// Parameters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java 2014-05-28 16:38:44 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java 2014-06-12 16:30:25 +0000
@@ -135,7 +135,7 @@
if ( writeGroupRequired && !userGroup.getMembers().contains( user) && !userService.canUpdate( user.getUserCredentials() ) )
{
- throw new UpdateAccessDeniedException( "- You don't have permission to add all selected users to this group." );
+ throw new UpdateAccessDeniedException( "You don't have permission to add all selected users to this group" );
}
}
@@ -158,7 +158,7 @@
if ( !otherGroupFound )
{
- throw new UpdateAccessDeniedException( "- You can't remove member who belongs to no other user groups that you control." );
+ throw new UpdateAccessDeniedException( "You can't remove member who belongs to no other user groups that you control" );
}
}
}
@@ -169,8 +169,8 @@
if ( jsonAttributeValues != null )
{
- AttributeUtils.updateAttributeValuesFromJson( userGroup.getAttributeValues(), jsonAttributeValues,
- attributeService );
+ AttributeUtils.updateAttributeValuesFromJson( userGroup.getAttributeValues(),
+ jsonAttributeValues, attributeService );
}
userGroupService.updateUserGroup( userGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2014-05-28 16:38:44 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2014-06-12 16:30:25 +0000
@@ -76,7 +76,6 @@
<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
- <property name="securityService" ref="org.hisp.dhis.security.SecurityService" />
</bean>
<bean id="org.hisp.dhis.dashboard.usergroup.action.AddUserGroupFormAction" class="org.hisp.dhis.dashboard.usergroup.action.AddUserGroupFormAction">