001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.vfs.metadata.value;
020:
021: import java.util.ArrayList;
022: import java.util.List;
023:
024: import org.openharmonise.vfs.metadata.*;
025:
026: /**
027: * This is the value for domain type properties.
028: *
029: * @author Matthew Large
030: * @version $Revision: 1.1 $
031: *
032: */
033: public class DomainValue implements ValueInstance {
034:
035: /**
036: * Collection resource type identifier.
037: */
038: public static String COLLECTION = "collection";
039:
040: /**
041: * Resource resource type identifier.
042: */
043: public static String RESOURCE = "resource";
044:
045: /**
046: * Property resource type identifier.
047: */
048: public static String PROPERTY = "property-resource";
049:
050: /**
051: * Value resource type identifier.
052: */
053: public static String VALUE = "value";
054:
055: /**
056: * Minimum occurrence.
057: */
058: private int m_nMinOccurs = 0;
059:
060: /**
061: * Maximum occurrence.
062: */
063: private int m_nMaxOccurs = -1;
064:
065: /**
066: * List of content types.
067: */
068: private ArrayList m_aContentTypes = new ArrayList();
069:
070: /**
071: * Resource type.
072: */
073: private String m_sResourceType = RESOURCE;
074:
075: /**
076: * Full path
077: */
078: private String m_sPath = null;
079:
080: public DomainValue() {
081: super ();
082: }
083:
084: /**
085: * Constructs a new domain value.
086: *
087: * @param sPath Full path
088: */
089: public DomainValue(String sPath) {
090: super ();
091: this .m_sPath = sPath;
092: }
093:
094: /**
095: * Constructs a new domain value.
096: *
097: * @param sPath Full path
098: * @param nMinOccurs Minimum occurrence
099: * @param nMaxOccurs Maximum occurrence
100: * @param aContentTypes List of content types
101: * @param sResourceType Resource type
102: */
103: public DomainValue(String sPath, int nMinOccurs, int nMaxOccurs,
104: List aContentTypes, String sResourceType) {
105: super ();
106: this .m_sPath = sPath;
107: this .m_nMinOccurs = nMinOccurs;
108: this .m_nMaxOccurs = nMaxOccurs;
109: this .m_aContentTypes = new ArrayList(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 sResourceType) {
155: this .m_sResourceType = sResourceType;
156: }
157:
158: /**
159: * Returns the resource type.
160: *
161: * @return Resource type
162: */
163: public String 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 aContentTypes) {
173: this .m_aContentTypes = new ArrayList(aContentTypes);
174: }
175:
176: /**
177: * Adds a content type.
178: *
179: * @param sContentType Content type
180: */
181: public void addContentType(String 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 getContentTypes() {
191: return (List) this .m_aContentTypes.clone();
192: }
193:
194: /**
195: * Sets the full path.
196: *
197: * @param sPath Full path
198: */
199: public void setPath(String sPath) {
200: this .m_sPath = sPath;
201: }
202:
203: /**
204: * Returns the full path.
205: *
206: * @return Full path
207: */
208: public String 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 arg0) {
216: if (super .equals(arg0)) {
217: return true;
218: } else {
219: return false;
220: }
221: }
222:
223: }
|