dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30087
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15272: Remove the orgunit-groups in Program object.
------------------------------------------------------------
revno: 15272
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-05-14 23:14:18 +0800
message:
Remove the orgunit-groups in Program object.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/DefineProgramAssociationsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programAssociations.vm
--
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/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-05-13 08:03:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2014-05-14 15:14:18 +0000
@@ -41,7 +41,6 @@
import org.hisp.dhis.common.view.WithoutOrganisationUnitsView;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -116,11 +115,6 @@
private Set<TrackedEntityInstanceReminder> instanceReminders = new HashSet<TrackedEntityInstanceReminder>();
/**
- * All OrganisationUnitGroup that register data with this program.
- */
- private Set<OrganisationUnitGroup> organisationUnitGroups = new HashSet<OrganisationUnitGroup>();
-
- /**
* Allow enrolling trackedEntity to all orgunit no matter what the program
* is assigned for the orgunit or not
*/
@@ -443,21 +437,6 @@
}
@JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
- @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 )
- public Set<OrganisationUnitGroup> getOrganisationUnitGroups()
- {
- return organisationUnitGroups;
- }
-
- public void setOrganisationUnitGroups( Set<OrganisationUnitGroup> organisationUnitGroups )
- {
- this.organisationUnitGroups = organisationUnitGroups;
- }
-
- @JsonProperty
@JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Boolean getDisplayOnAllOrgunit()
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-04-29 11:11:30 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-05-14 15:14:18 +0000
@@ -551,18 +551,7 @@
{
assignedToOrganisationUnit = true;
}
- else
- {
- for ( OrganisationUnitGroup organisationUnitGroup : program.getOrganisationUnitGroups() )
- {
- if ( organisationUnitGroup.getMembers().contains( organisationUnit ) )
- {
- assignedToOrganisationUnit = true;
- break;
- }
- }
- }
-
+
return !assignedToOrganisationUnit;
}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2014-05-09 15:49:36 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStore.java 2014-05-14 15:14:18 +0000
@@ -84,28 +84,10 @@
@Override
public Collection<Program> get( OrganisationUnit organisationUnit )
{
- Criteria criteria1 = getCriteria();
- criteria1.createAlias( "organisationUnits", "orgunit" );
- criteria1.add( Restrictions.eq( "orgunit.id", organisationUnit.getId() ) );
-
- Criteria criteria2 = getCriteria();
- criteria2.createAlias( "organisationUnitGroups", "orgunitGroup" );
- criteria2.createAlias( "orgunitGroup.members", "orgunitMember" );
- criteria2.add( Restrictions.eq( "orgunitMember.id", organisationUnit.getId() ) );
-
- Collection<Program> programs = new HashSet<Program>();
-
- if ( criteria1.list() != null )
- {
- programs.addAll( criteria1.list() );
- }
-
- if ( criteria2.list() != null )
- {
- programs.addAll( criteria2.list() );
- }
-
- return programs;
+ Criteria criteria = getCriteria();
+ criteria.createAlias( "organisationUnits", "orgunit" );
+ criteria.add( Restrictions.eq( "orgunit.id", organisationUnit.getId() ) );
+ return criteria.list();
}
@SuppressWarnings( "unchecked" )
@@ -116,25 +98,7 @@
criteria1.createAlias( "organisationUnits", "orgunit" );
criteria1.add( Restrictions.eq( "type", type ) );
criteria1.add( Restrictions.eq( "orgunit.id", organisationUnit.getId() ) );
-
- Criteria criteria2 = getCriteria();
- criteria2.createAlias( "organisationUnitGroups", "orgunitGroup" );
- criteria2.createAlias( "orgunitGroup.members", "orgunitMember" );
- criteria2.add( Restrictions.eq( "type", type ) );
- criteria2.add( Restrictions.eq( "orgunitMember.id", organisationUnit.getId() ) );
-
- Collection<Program> programs = new HashSet<Program>();
- if ( criteria1.list() != null )
- {
- programs.addAll( criteria1.list() );
- }
-
- if ( criteria2.list() != null )
- {
- programs.addAll( criteria2.list() );
- }
-
- return programs;
+ return criteria1.list();
}
@Override
@@ -193,40 +157,15 @@
@SuppressWarnings( "unchecked" )
public Collection<Program> getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit )
{
- Collection<Program> programs = new HashSet<Program>();
-
+ Criteria criteria = getCriteria();
+ criteria.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
if ( orgunit != null )
{
- Criteria criteria1 = getCriteria();
- criteria1.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
- criteria1.createAlias( "organisationUnits", "orgunit" );
- criteria1.add( Restrictions.eq( "orgunit.id", orgunit.getId() ) );
-
- Criteria criteria2 = getCriteria();
- criteria1.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
- criteria2.createAlias( "organisationUnitGroups", "orgunitGroup" );
- criteria2.createAlias( "orgunitGroup.members", "orgunitMember" );
- criteria2.add( Restrictions.eq( "orgunitMember.id", orgunit.getId() ) );
-
- if ( criteria1.list() != null )
- {
- programs.addAll( criteria1.list() );
- }
-
- if ( criteria2.list() != null )
- {
- programs.addAll( criteria2.list() );
- }
- }
- else
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.eq( "displayOnAllOrgunit", displayOnAllOrgunit ) );
-
- programs = criteria.list();
- }
-
- return programs;
+ criteria.createAlias( "organisationUnits", "orgunit" );
+ criteria.add( Restrictions.eq( "orgunit.id", orgunit.getId() ) );
+ }
+
+ return criteria.list();
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2014-04-17 12:09:39 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2014-05-14 15:14:18 +0000
@@ -293,6 +293,8 @@
executeSql( "UPDATE trackedentityattribute SET valuetype='string' WHERE valuetype='localId';" );
executeSql( "UPDATE trackedentityattribute SET valuetype='number' WHERE valuetype='age'" );
+
+ executeSql( "DROP TABLE orgunitgroupprograms" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2014-04-08 15:44:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2014-05-14 15:14:18 +0000
@@ -67,12 +67,6 @@
<one-to-many class="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder" />
</set>
- <set name="organisationUnitGroups" table="orgunitgroupprograms">
- <key column="programid" />
- <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup"
- column="orgunitgroupid" />
- </set>
-
<property name="displayOnAllOrgunit" />
<property name="selectEnrollmentDatesInFuture" />
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java 2014-04-12 12:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java 2014-05-14 15:14:18 +0000
@@ -37,7 +37,6 @@
import java.util.Map;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
@@ -200,15 +199,6 @@
{
Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
- if ( program.getOrganisationUnitGroups().size() > 0 )
- {
- for ( OrganisationUnitGroup orgunitGroup : program.getOrganisationUnitGroups() )
- {
- orgunits.addAll( orgunitGroup.getMembers() );
- }
-
- }
-
if ( !orgunits.contains( orgunit ) && !program.getOrganisationUnits().contains( orgunit ) )
{
return false;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/DefineProgramAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/DefineProgramAssociationsAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/DefineProgramAssociationsAction.java 2014-05-14 15:14:18 +0000
@@ -33,8 +33,6 @@
import java.util.Set;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
@@ -49,18 +47,10 @@
public class DefineProgramAssociationsAction
implements Action
{
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
private SelectionTreeManager selectionTreeManager;
public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
@@ -86,13 +76,6 @@
this.id = id;
}
- private Collection<Integer> orgunitGroupIds = new HashSet<Integer>();
-
- public void setOrgunitGroupIds( Collection<Integer> orgunitGroupIds )
- {
- this.orgunitGroupIds = orgunitGroupIds;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -118,17 +101,7 @@
assignedUnits.addAll( convert( selectedOrganisationUnits ) );
program.setOrganisationUnits( assignedUnits );
-
- if ( orgunitGroupIds != null )
- {
- Set<OrganisationUnitGroup> orgunitGroups = new HashSet<OrganisationUnitGroup>();
- for ( Integer orgunitGroupId : orgunitGroupIds )
- {
- orgunitGroups.add( organisationUnitGroupService.getOrganisationUnitGroup( orgunitGroupId ) );
- }
- program.setOrganisationUnitGroups( orgunitGroups );
- }
-
+
programService.updateProgram( program );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetProgramAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/GetProgramAction.java 2014-05-14 15:14:18 +0000
@@ -32,7 +32,6 @@
import java.util.List;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.program.Program;
@@ -53,13 +52,6 @@
// Dependencies
// -------------------------------------------------------------------------
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
private ProgramService programService;
public void setProgramService( ProgramService programService )
@@ -129,25 +121,6 @@
{
this.level = level;
}
-
- private Integer organisationUnitGroupId;
-
- public Integer getOrganisationUnitGroupId()
- {
- return organisationUnitGroupId;
- }
-
- public void setOrganisationUnitGroupId( Integer organisationUnitGroupId )
- {
- this.organisationUnitGroupId = organisationUnitGroupId;
- }
-
- private List<OrganisationUnitGroup> availableOrgunitGroups = new ArrayList<OrganisationUnitGroup>();
-
- public List<OrganisationUnitGroup> getAvailableOrgunitGroups()
- {
- return availableOrgunitGroups;
- }
private List<UserGroup> userGroups;
@@ -165,9 +138,6 @@
{
program = programService.getProgram( id );
- availableOrgunitGroups = new ArrayList<OrganisationUnitGroup>(organisationUnitGroupService.getAllOrganisationUnitGroups());
- availableOrgunitGroups.removeAll( program.getOrganisationUnitGroups() );
-
selectionTreeManager.setSelectedOrganisationUnits( program.getOrganisationUnits() );
userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2014-04-15 14:30:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2014-05-14 15:14:18 +0000
@@ -198,8 +198,6 @@
<bean id="org.hisp.dhis.trackedentity.action.program.GetProgramAction"
class="org.hisp.dhis.trackedentity.action.program.GetProgramAction"
scope="prototype">
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
<property name="selectionTreeManager"
ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
@@ -275,8 +273,6 @@
id="org.hisp.dhis.trackedentity.action.program.DefineProgramAssociationsAction"
class="org.hisp.dhis.trackedentity.action.program.DefineProgramAssociationsAction"
scope="prototype">
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="selectionTreeManager"
ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programAssociations.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programAssociations.vm 2014-04-04 12:59:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programAssociations.vm 2014-05-14 15:14:18 +0000
@@ -5,71 +5,18 @@
<form id="defineProgramAssociationsForm" action="defineProgramAssociations.action" method="post">
-
- <div id="tabs">
- <ul>
- <li><a href="#tab-1">$i18n.getString("orgunit")</a></li>
- <li><a href="#tab-2">$i18n.getString( "orgunit_group" )</a></li>
- </ul>
- <div id="tab-1">
- <div style="display:inline">
- <input type="hidden" name="id" value="$program.id">
- </div>
- <table id="selectionTable">
+ <input type="hidden" name="id" value="$program.id">
+ <table id="selectionTable">
<tr>
<td>
#organisationUnitSelectionTree( false, true, false )
</td>
</tr>
- </table>
- </div>
- <div id="tab-2">
- <table>
- <colgroup>
- <col style='width:500px'/>
- <col/>
- <col style='width:500px'/>
- </colgroup>
- <thead>
- <tr>
- <th>$i18n.getString( "available" )</th>
- <th>$i18n.getString( "filter" )</th>
- <th>$i18n.getString( "selected" )</th>
- </tr>
- </thead>
- <tr>
- <td>
- <select multiple id='orgunitGroupAvailable' style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'orgunitGroupAvailable', 'orgunitGroupIds' )">
- #foreach($group in $availableOrgunitGroups)
- <option value='$group.id'>$encoder.htmlEncode($group.name)</option>
- #end
- </select>
- </td>
- <td>
- <input type="button" style="width:40px" value=">" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'orgunitGroupAvailable', 'orgunitGroupIds' )" /><br>
- <input type="button" style="width:40px" value=">>" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'orgunitGroupAvailable', 'orgunitGroupIds' )" /><br>
- <input type="button" style="width:40px" value="<" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'orgunitGroupIds', 'orgunitGroupAvailable' )" /><br>
- <input type="button" style="width:40px" value="<<" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'orgunitGroupIds', 'orgunitGroupAvailable' )" />
- </td>
- <td>
- <select multiple id='orgunitGroupIds' name='orgunitGroupIds' style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'orgunitGroupIds', 'orgunitGroupAvailable' )">
- #foreach($group in $program.organisationUnitGroups)
- <option value='$group.id'>$encoder.htmlEncode($group.name)</option>
- #end
- </select>
- </td>
- </tr>
- </table>
- </div>
-
- <p style='padding-left:20px'>
- <input type="submit" id="submitButton" value="$i18n.getString( "save" )" style="width:10em">
- <input type="button" onclick="window.location.href='program.action'" value="$i18n.getString( "cancel" )" style="width:10em">
- </p>
+ <tr>
+ <td>
+ <input type="submit" id="submitButton" value="$i18n.getString( "save" )" style="width:10em">
+ <input type="button" onclick="window.location.href='program.action'" value="$i18n.getString( "cancel" )" style="width:10em">
+ </td>
+ </tr>
+ </table>
</form>
-
-<script type="text/javascript">
- var levelMustBeInt = '$encoder.jsEncode( $i18n.getString( "level_must_be_int" ) )';
- var i18n_loading = '$encoder.jsEncode( $i18n.getString( "loading" ) )';
- $('#tabs').tabs();
-</script>