~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.dhis.report;
 
2
 
 
3
/*
 
4
 * Copyright (c) 2004-2007, University of Oslo
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions are met:
 
9
 * * Redistributions of source code must retain the above copyright notice, this
 
10
 *   list of conditions and the following disclaimer.
 
11
 * * Redistributions in binary form must reproduce the above copyright notice,
 
12
 *   this list of conditions and the following disclaimer in the documentation
 
13
 *   and/or other materials provided with the distribution.
 
14
 * * Neither the name of the HISP project nor the names of its contributors may
 
15
 *   be used to endorse or promote products derived from this software without
 
16
 *   specific prior written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
21
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 
22
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 
25
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
 */
 
29
 
 
30
import java.io.Serializable;
 
31
import java.util.HashSet;
 
32
import java.util.Set;
 
33
 
 
34
import org.hisp.dhis.reporttable.ReportTable;
 
35
 
 
36
/**
 
37
 * @author Lars Helge Overland
 
38
 * @version $Id$
 
39
 */
 
40
public class Report
 
41
    implements Serializable
 
42
{
 
43
    private int id;
 
44
    
 
45
    private String name;
 
46
    
 
47
    private String design;
 
48
    
 
49
    private Set<ReportTable> reportTables = new HashSet<ReportTable>();
 
50
    
 
51
    private String url;
 
52
 
 
53
    // -------------------------------------------------------------------------
 
54
    // Constructors
 
55
    // -------------------------------------------------------------------------
 
56
 
 
57
    public Report()
 
58
    {   
 
59
    }
 
60
    
 
61
    public Report( String name, String design, Set<ReportTable> reportTable )
 
62
    {
 
63
        this.name = name;
 
64
        this.design = design;
 
65
        this.reportTables = reportTable;
 
66
    }
 
67
 
 
68
    // -------------------------------------------------------------------------
 
69
    // Logic
 
70
    // -------------------------------------------------------------------------
 
71
 
 
72
    public boolean isHasReportTable()
 
73
    {
 
74
        return reportTables != null;
 
75
    }
 
76
    
 
77
    // -------------------------------------------------------------------------
 
78
    // Equals and hashCode
 
79
    // -------------------------------------------------------------------------
 
80
 
 
81
    @Override
 
82
    public int hashCode()
 
83
    {
 
84
        final int prime = 31;
 
85
        
 
86
        int result = 1;
 
87
        
 
88
        result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
 
89
        
 
90
        return result;
 
91
    }
 
92
 
 
93
    @Override
 
94
    public boolean equals( Object object )
 
95
    {
 
96
        if ( this == object )
 
97
        {
 
98
            return true;
 
99
        }
 
100
        
 
101
        if ( object == null )
 
102
        {
 
103
            return false;
 
104
        }
 
105
        
 
106
        if ( getClass() != object.getClass() )
 
107
        {
 
108
            return false;
 
109
        }
 
110
        
 
111
        final Report other = (Report) object;
 
112
        
 
113
        return this.name.equals( other.getName() );
 
114
    }    
 
115
 
 
116
    // -------------------------------------------------------------------------
 
117
    // Getters and setters
 
118
    // -------------------------------------------------------------------------
 
119
 
 
120
    public int getId()
 
121
    {
 
122
        return id;
 
123
    }
 
124
 
 
125
    public void setId( int id )
 
126
    {
 
127
        this.id = id;
 
128
    }
 
129
 
 
130
    public String getName()
 
131
    {
 
132
        return name;
 
133
    }
 
134
 
 
135
    public void setName( String name )
 
136
    {
 
137
        this.name = name;
 
138
    }
 
139
 
 
140
    public String getDesign()
 
141
    {
 
142
        return design;
 
143
    }
 
144
 
 
145
    public void setDesign( String design )
 
146
    {
 
147
        this.design = design;
 
148
    }
 
149
 
 
150
    public Set<ReportTable> getReportTables()
 
151
    {
 
152
        return reportTables;
 
153
    }
 
154
 
 
155
    public void setReportTables( Set<ReportTable> reportTables )
 
156
    {
 
157
        this.reportTables = reportTables;
 
158
    }
 
159
 
 
160
    public String getUrl()
 
161
    {
 
162
        return url;
 
163
    }
 
164
 
 
165
    public void setUrl( String url )
 
166
    {
 
167
        this.url = url;
 
168
    }
 
169
}