KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > vfs > metadata > value > DomainValue


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.vfs.metadata.value;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.List JavaDoc;
23
24 import org.openharmonise.vfs.metadata.*;
25
26
27 /**
28  * This is the value for domain type properties.
29  *
30  * @author Matthew Large
31  * @version $Revision: 1.1 $
32  *
33  */

34 public class DomainValue implements ValueInstance {
35
36     /**
37      * Collection resource type identifier.
38      */

39     public static String JavaDoc COLLECTION = "collection";
40
41     /**
42      * Resource resource type identifier.
43      */

44     public static String JavaDoc RESOURCE = "resource";
45
46     /**
47      * Property resource type identifier.
48      */

49     public static String JavaDoc PROPERTY = "property-resource";
50
51     /**
52      * Value resource type identifier.
53      */

54     public static String JavaDoc VALUE = "value";
55
56     /**
57      * Minimum occurrence.
58      */

59     private int m_nMinOccurs = 0;
60
61     /**
62      * Maximum occurrence.
63      */

64     private int m_nMaxOccurs = -1;
65     
66     /**
67      * List of content types.
68      */

69     private ArrayList JavaDoc m_aContentTypes = new ArrayList JavaDoc();
70     
71     /**
72      * Resource type.
73      */

74     private String JavaDoc m_sResourceType = RESOURCE;
75     
76     /**
77      * Full path
78      */

79     private String JavaDoc m_sPath = null;
80
81     public DomainValue() {
82         super();
83     }
84
85     /**
86      * Constructs a new domain value.
87      *
88      * @param sPath Full path
89      */

90     public DomainValue(String JavaDoc sPath) {
91         super();
92         this.m_sPath = sPath;
93     }
94
95     /**
96      * Constructs a new domain value.
97      *
98      * @param sPath Full path
99      * @param nMinOccurs Minimum occurrence
100      * @param nMaxOccurs Maximum occurrence
101      * @param aContentTypes List of content types
102      * @param sResourceType Resource type
103      */

104     public DomainValue(String JavaDoc sPath, int nMinOccurs, int nMaxOccurs, List JavaDoc aContentTypes, String JavaDoc sResourceType) {
105         super();
106         this.m_sPath = sPath;
107         this.m_nMinOccurs = nMinOccurs;
108         this.m_nMaxOccurs = nMaxOccurs;
109         this.m_aContentTypes = new ArrayList JavaDoc(aContentTypes);
110         this.m_sResourceType = sResourceType;
111     }
112     
113     /**
114      * Sets the minimum occurrence.
115      *
116      * @param nMinOccurs Minimum occurrence
117      */

118     public void setMinOccurs(int nMinOccurs) {
119         this.m_nMinOccurs = nMinOccurs;
120     }
121     
122     /**
123      * Returns the minimum occurrence
124      *
125      * @return Minimum occurrence
126      */

127     public int getMinOccurs() {
128         return this.m_nMinOccurs;
129     }
130     
131     /**
132      * Sets the maximum occurrence.
133      *
134      * @param nMaxOccurs Maximum occurrence
135      */

136     public void setMaxOccurs(int nMaxOccurs) {
137         this.m_nMaxOccurs = nMaxOccurs;
138     }
139     
140     /**
141      * Returns the maximum occurrence
142      *
143      * @return Maximum occurrence
144      */

145     public int getMaxOccurs() {
146         return this.m_nMaxOccurs;
147     }
148     
149     /**
150      * Sets the resource type.
151      *
152      * @param sResourceType Resource type
153      */

154     public void setResourceType(String JavaDoc sResourceType) {
155         this.m_sResourceType = sResourceType;
156     }
157     
158     /**
159      * Returns the resource type.
160      *
161      * @return Resource type
162      */

163     public String JavaDoc getResourceType() {
164         return this.m_sResourceType;
165     }
166     
167     /**
168      * Sets the list of content types.
169      *
170      * @param aContentTypes List of content types.
171      */

172     public void setContentTypes(List JavaDoc aContentTypes) {
173         this.m_aContentTypes = new ArrayList JavaDoc(aContentTypes);
174     }
175     
176     /**
177      * Adds a content type.
178      *
179      * @param sContentType Content type
180      */

181     public void addContentType(String JavaDoc sContentType) {
182         this.m_aContentTypes.add(sContentType);
183     }
184     
185     /**
186      * Returns a list of content types.
187      *
188      * @return List of content types.
189      */

190     public List JavaDoc getContentTypes() {
191         return (List JavaDoc) this.m_aContentTypes.clone();
192     }
193     
194     /**
195      * Sets the full path.
196      *
197      * @param sPath Full path
198      */

199     public void setPath(String JavaDoc sPath) {
200         this.m_sPath = sPath;
201     }
202     
203     /**
204      * Returns the full path.
205      *
206      * @return Full path
207      */

208     public String JavaDoc getPath() {
209         return this.m_sPath;
210     }
211     
212     /* (non-Javadoc)
213      * @see java.lang.Object#equals(java.lang.Object)
214      */

215     public boolean equals(Object JavaDoc arg0) {
216         if(super.equals(arg0)) {
217             return true;
218         } else {
219             return false;
220         }
221     }
222
223 }
224
Popular Tags