~inf5750-charting/dhis2-academy/charting

« back to all changes in this revision

Viewing changes to local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeFormAction.java

  • Committer: Abyot Asalefew Gizaw
  • Date: 2012-10-12 00:13:55 UTC
  • Revision ID: abyota@gmail.com-20121012001355-yehfghfqirdvqmd7
Updating the acadmy trunk with the main DHIS2 trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.dhis.coldchain.catalog.action;
 
2
 
 
3
import java.util.ArrayList;
 
4
import java.util.Collection;
 
5
 
 
6
import org.hisp.dhis.coldchain.catalog.CatalogType;
 
7
import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
 
8
import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
 
9
 
 
10
import com.opensymphony.xwork2.Action;
 
11
 
 
12
public class UpdateCatalogTypeFormAction
 
13
implements Action
 
14
{
 
15
    // -------------------------------------------------------------------------
 
16
    // Dependencies
 
17
    // -------------------------------------------------------------------------
 
18
    
 
19
    private CatalogTypeService catalogTypeService;
 
20
    
 
21
    public void setCatalogTypeService( CatalogTypeService catalogTypeService )
 
22
    {
 
23
        this.catalogTypeService = catalogTypeService;
 
24
    }
 
25
 
 
26
    // -------------------------------------------------------------------------
 
27
    // Input/Output
 
28
    // -------------------------------------------------------------------------
 
29
 
 
30
    private int id;
 
31
 
 
32
    public int getId()
 
33
    {
 
34
        return id;
 
35
    }
 
36
 
 
37
    public void setId( int id )
 
38
    {
 
39
        this.id = id;
 
40
    }
 
41
 
 
42
    private CatalogType catalogType;
 
43
 
 
44
    public CatalogType getCatalogType()
 
45
    {
 
46
        return catalogType;
 
47
    }
 
48
 
 
49
    private Collection<CatalogTypeAttribute> catalogTypeAttributes;
 
50
    
 
51
    public Collection<CatalogTypeAttribute> getCatalogTypeAttributes()
 
52
    {
 
53
        return catalogTypeAttributes;
 
54
    }
 
55
 
 
56
    // -------------------------------------------------------------------------
 
57
    // Action implementation
 
58
    // -------------------------------------------------------------------------
 
59
 
 
60
    public String execute() throws Exception
 
61
    {
 
62
       
 
63
        //System.out.println( id );
 
64
        catalogType = catalogTypeService.getCatalogType( id );
 
65
        
 
66
        //System.out.println( catalogType.getId() + "-----"+catalogType.getDescription());
 
67
        
 
68
        catalogTypeAttributes = new ArrayList<CatalogTypeAttribute>( catalogType.getCatalogTypeAttributes());        
 
69
        //catalogTypeAttributes = catalogType.getCatalogTypeAttributes();
 
70
        
 
71
        //programStage = programStageService.getProgramStage( id );
 
72
 
 
73
        //programStageDataElements = programStage.getProgramStageDataElements();
 
74
 
 
75
        return SUCCESS;
 
76
    }
 
77
}
 
78