KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > api > metadata > common > domain > client > ResourceLookupImpl


1 /*
2  * Copyright (C) 2006 JasperSoft http://www.jaspersoft.com
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed WITHOUT ANY WARRANTY; and without the
10  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
15  * or write to:
16  *
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330,
19  * Boston, MA USA 02111-1307
20  */

21 package com.jaspersoft.jasperserver.api.metadata.common.domain.client;
22
23 import java.util.Date JavaDoc;
24 import java.util.List JavaDoc;
25
26 import com.jaspersoft.jasperserver.api.JSException;
27 import com.jaspersoft.jasperserver.api.metadata.common.domain.Folder;
28 import com.jaspersoft.jasperserver.api.metadata.common.domain.Resource;
29 import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceLookup;
30
31 /**
32  * @author Lucian Chirita (lucianc@users.sourceforge.net)
33  * @version $Id: ResourceLookupImpl.java 3811 2006-06-23 13:00:21Z swood $
34  */

35 public class ResourceLookupImpl implements ResourceLookup {
36     
37     private int version;
38     private Date JavaDoc creationDate;
39     private String JavaDoc name;
40     private String JavaDoc label;
41     private String JavaDoc description;
42     private String JavaDoc folderUri;
43     private String JavaDoc uri;
44     private String JavaDoc resourceType;
45
46     public ResourceLookupImpl() {
47     }
48
49     public String JavaDoc getName() {
50         return name;
51     }
52
53     public String JavaDoc getLabel() {
54         return label;
55     }
56
57     public String JavaDoc getDescription() {
58         return description;
59     }
60
61     public List JavaDoc getAttributes() {
62         // TODO Auto-generated method stub
63
return null;
64     }
65
66     public void setDescription(String JavaDoc description) {
67         this.description = description;
68     }
69
70     public void setLabel(String JavaDoc label) {
71         this.label = label;
72     }
73
74     public void setName(String JavaDoc name) {
75         this.uri = null;
76         this.name = name;
77     }
78
79     public String JavaDoc getURIString()
80     {
81         if (uri == null) {
82             StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
83             if (getParentFolder() != null && !getParentFolder().equals(Folder.SEPARATOR))
84                 sb.append(getParentFolder());
85             sb.append(Folder.SEPARATOR);
86             if (!getName().equals(Folder.SEPARATOR))
87                 sb.append(getName());
88             uri = sb.toString();
89         }
90         return uri;
91     }
92
93     /* (non-Javadoc)
94      * @see com.jaspersoft.jasperserver.api.metadata.common.domain.InternalURI#getURI()
95      */

96     public String JavaDoc getURI() {
97         return getProtocol() + ":" + getPath();
98     }
99     
100     public String JavaDoc getParentURI() {
101         return getParentFolder() == null ? null : getProtocol() + ":" + getParentFolder();
102     }
103     
104     public String JavaDoc getParentPath() {
105         return getParentFolder() == null ? null : getParentFolder();
106     }
107
108     /* (non-Javadoc)
109      * @see com.jaspersoft.jasperserver.api.metadata.common.domain.InternalURI#getPath()
110      */

111     public String JavaDoc getPath() {
112         return getURIString();
113     }
114
115     /* (non-Javadoc)
116      * @see com.jaspersoft.jasperserver.api.metadata.common.domain.InternalURI#getProtocol()
117      */

118     public String JavaDoc getProtocol() {
119         return Resource.URI_PROTOCOL;
120     }
121
122     public String JavaDoc getParentFolder() {
123         return folderUri;
124     }
125
126     public void setParentFolder(Folder folder) {
127         this.uri = null;
128         folderUri = folder.getURIString();
129     }
130
131     public void setParentFolder(String JavaDoc folderURI) {
132         this.uri = null;
133         folderUri = folderURI;
134     }
135
136     public void setURI(String JavaDoc uri) {
137         this.uri = uri;
138     }
139
140     protected final JSException lookupUnsupportedException() {
141         return new JSException("The call is not supported by resource lookup objects.");
142     }
143
144     public int getVersion() {
145         return version;
146     }
147
148     public void setVersion(int version) {
149         this.version = version;
150     }
151
152     public String JavaDoc getResourceType() {
153         return resourceType;
154     }
155
156     public void setResourceType(String JavaDoc resourceType) {
157         this.resourceType = resourceType;
158     }
159
160     public Date JavaDoc getCreationDate() {
161         return creationDate;
162     }
163
164     public void setCreationDate(Date JavaDoc creationDate) {
165         this.creationDate = creationDate;
166     }
167
168     public boolean isNew() {
169         return false;
170     }
171
172     public void setURIString(String JavaDoc uri) {
173         this.uri = uri;
174     }
175 }
176
Popular Tags