~dhis2-devs-core/dhis2/dhis2-patient-tz

« back to all changes in this revision

Viewing changes to local/tz/dhis-web-caseentry-tz/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanAction.java

  • Committer: John Francis Mukulu
  • Date: 2011-08-09 06:36:18 UTC
  • mfrom: (4244.1.21 dhis2)
  • Revision ID: john.f.mukulu@gmail.com-20110809063618-wad1pcc9fd1mnc6k
[merge]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2004-2009, University of Oslo
3
 
 * All rights reserved.
4
 
 *
5
 
 * Redistribution and use in source and binary forms, with or without
6
 
 * modification, are permitted provided that the following conditions are met:
7
 
 * * Redistributions of source code must retain the above copyright notice, this
8
 
 *   list of conditions and the following disclaimer.
9
 
 * * Redistributions in binary form must reproduce the above copyright notice,
10
 
 *   this list of conditions and the following disclaimer in the documentation
11
 
 *   and/or other materials provided with the distribution.
12
 
 * * Neither the name of the HISP project nor the names of its contributors may
13
 
 *   be used to endorse or promote products derived from this software without
14
 
 *   specific prior written permission.
15
 
 *
16
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
 
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20
 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23
 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 
 */
27
 
 
28
 
package org.hisp.dhis.caseentry.action.visitplan;
29
 
 
30
 
import java.util.Collection;
31
 
import java.util.HashSet;
32
 
 
33
 
import org.hisp.dhis.organisationunit.OrganisationUnit;
34
 
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
35
 
import org.hisp.dhis.patient.PatientAttribute;
36
 
import org.hisp.dhis.patient.PatientAttributeService;
37
 
 
38
 
import com.opensymphony.xwork2.Action;
39
 
 
40
 
/**
41
 
 * @author Abyot Asalefew Gizaw
42
 
 * @version $Id$
43
 
 * @modifier Dang Duy Hieu
44
 
 * @since 2011-12-05
45
 
 */
46
 
public class VisitPlanAction
47
 
    implements Action
48
 
{
49
 
    // -------------------------------------------------------------------------
50
 
    // Dependencies
51
 
    // -------------------------------------------------------------------------
52
 
 
53
 
    private OrganisationUnitSelectionManager selectionManager;
54
 
 
55
 
    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
56
 
    {
57
 
        this.selectionManager = selectionManager;
58
 
    }
59
 
 
60
 
    private PatientAttributeService patientAttributeService;
61
 
 
62
 
    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
63
 
    {
64
 
        this.patientAttributeService = patientAttributeService;
65
 
    }
66
 
 
67
 
    // -------------------------------------------------------------------------
68
 
    // Output
69
 
    // -------------------------------------------------------------------------
70
 
 
71
 
    private Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
72
 
 
73
 
    public Collection<PatientAttribute> getAttributes()
74
 
    {
75
 
        return attributes;
76
 
    }
77
 
 
78
 
    private OrganisationUnit organisationUnit;
79
 
 
80
 
    public OrganisationUnit getOrganisationUnit()
81
 
    {
82
 
        return organisationUnit;
83
 
    }
84
 
 
85
 
    // -------------------------------------------------------------------------
86
 
    // Action implementation
87
 
    // -------------------------------------------------------------------------
88
 
 
89
 
    public String execute()
90
 
        throws Exception
91
 
    {
92
 
        organisationUnit = selectionManager.getSelectedOrganisationUnit();
93
 
 
94
 
        if ( organisationUnit == null )
95
 
        {
96
 
            return SUCCESS;
97
 
        }
98
 
 
99
 
        attributes = patientAttributeService.getAllPatientAttributes();
100
 
 
101
 
        return SUCCESS;
102
 
    }
103
 
}