001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: /* @generated Thu Sep 27 15:21:47 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/glm/src/org/cougaar/glm/ldm/asset/alpprops.def - DO NOT HAND EDIT */
028: /** Implementation of PersonPG.
029: * @see PersonPG
030: * @see NewPersonPG
031: **/package org.cougaar.glm.ldm.asset;
032:
033: import org.cougaar.planning.ldm.measure.*;
034: import org.cougaar.planning.ldm.asset.*;
035: import org.cougaar.planning.ldm.plan.*;
036: import java.util.*;
037:
038: import org.cougaar.glm.ldm.plan.*;
039: import org.cougaar.glm.ldm.oplan.*;
040: import org.cougaar.glm.ldm.policy.*;
041: import org.cougaar.core.mts.MessageAddress;
042: import org.cougaar.glm.execution.common.InventoryReport;
043:
044: import java.io.ObjectOutputStream;
045: import java.io.ObjectInputStream;
046: import java.io.IOException;
047: import java.beans.PropertyDescriptor;
048: import java.beans.IndexedPropertyDescriptor;
049:
050: public class PersonPGImpl extends java.beans.SimpleBeanInfo implements
051: NewPersonPG, Cloneable {
052: public PersonPGImpl() {
053: }
054:
055: // Slots
056:
057: private String theIDCode;
058:
059: public String getIDCode() {
060: return theIDCode;
061: }
062:
063: public void setIDCode(String ID_code) {
064: theIDCode = ID_code;
065: }
066:
067: private String theNationality;
068:
069: public String getNationality() {
070: return theNationality;
071: }
072:
073: public void setNationality(String nationality) {
074: theNationality = nationality;
075: }
076:
077: private Collection theSkills;
078:
079: public Collection getSkills() {
080: return theSkills;
081: }
082:
083: public boolean inSkills(Skill _element) {
084: return (theSkills == null) ? false : (theSkills
085: .contains(_element));
086: }
087:
088: public Skill[] getSkillsAsArray() {
089: if (theSkills == null)
090: return new Skill[0];
091: int l = theSkills.size();
092: Skill[] v = new Skill[l];
093: int i = 0;
094: for (Iterator n = theSkills.iterator(); n.hasNext();) {
095: v[i] = (Skill) n.next();
096: i++;
097: }
098: return v;
099: }
100:
101: public Skill getIndexedSkills(int _index) {
102: if (theSkills == null)
103: return null;
104: for (Iterator _i = theSkills.iterator(); _i.hasNext();) {
105: Skill _e = (Skill) _i.next();
106: if (_index == 0)
107: return _e;
108: _index--;
109: }
110: return null;
111: }
112:
113: public void setSkills(Collection skills) {
114: theSkills = skills;
115: }
116:
117: public void clearSkills() {
118: theSkills.clear();
119: }
120:
121: public boolean removeFromSkills(Skill _element) {
122: return theSkills.remove(_element);
123: }
124:
125: public boolean addToSkills(Skill _element) {
126: return theSkills.add(_element);
127: }
128:
129: public PersonPGImpl(PersonPG original) {
130: theIDCode = original.getIDCode();
131: theNationality = original.getNationality();
132: theSkills = original.getSkills();
133: }
134:
135: public boolean equals(Object other) {
136:
137: if (!(other instanceof PersonPG)) {
138: return false;
139: }
140:
141: PersonPG otherPersonPG = (PersonPG) other;
142:
143: if (getIDCode() == null) {
144: if (otherPersonPG.getIDCode() != null) {
145: return false;
146: }
147: } else if (!(getIDCode().equals(otherPersonPG.getIDCode()))) {
148: return false;
149: }
150:
151: if (getNationality() == null) {
152: if (otherPersonPG.getNationality() != null) {
153: return false;
154: }
155: } else if (!(getNationality().equals(otherPersonPG
156: .getNationality()))) {
157: return false;
158: }
159:
160: if (getSkills() == null) {
161: if (otherPersonPG.getSkills() != null) {
162: return false;
163: }
164: } else if (!(getSkills().equals(otherPersonPG.getSkills()))) {
165: return false;
166: }
167:
168: return true;
169: }
170:
171: public boolean hasDataQuality() {
172: return false;
173: }
174:
175: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
176: return null;
177: }
178:
179: // static inner extension class for real DataQuality Support
180: public final static class DQ extends PersonPGImpl implements
181: org.cougaar.planning.ldm.dq.NewHasDataQuality {
182: public DQ() {
183: super ();
184: }
185:
186: public DQ(PersonPG original) {
187: super (original);
188: }
189:
190: public Object clone() {
191: return new DQ(this );
192: }
193:
194: private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null;
195:
196: public boolean hasDataQuality() {
197: return (_dq != null);
198: }
199:
200: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
201: return _dq;
202: }
203:
204: public void setDataQuality(
205: org.cougaar.planning.ldm.dq.DataQuality dq) {
206: _dq = dq;
207: }
208:
209: private void writeObject(ObjectOutputStream out)
210: throws IOException {
211: out.defaultWriteObject();
212: if (out instanceof org.cougaar.core.persist.PersistenceOutputStream)
213: out.writeObject(_dq);
214: }
215:
216: private void readObject(ObjectInputStream in)
217: throws ClassNotFoundException, IOException {
218: in.defaultReadObject();
219: if (in instanceof org.cougaar.core.persist.PersistenceInputStream)
220: _dq = (org.cougaar.planning.ldm.dq.DataQuality) in
221: .readObject();
222: }
223:
224: private final static PropertyDescriptor properties[] = new PropertyDescriptor[1];
225: static {
226: try {
227: properties[0] = new PropertyDescriptor("dataQuality",
228: DQ.class, "getDataQuality", null);
229: } catch (Exception e) {
230: e.printStackTrace();
231: }
232: }
233:
234: public PropertyDescriptor[] getPropertyDescriptors() {
235: PropertyDescriptor[] pds = super .properties;
236: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length
237: + properties.length];
238: System.arraycopy(pds, 0, ps, 0, pds.length);
239: System.arraycopy(properties, 0, ps, pds.length,
240: properties.length);
241: return ps;
242: }
243: }
244:
245: private transient PersonPG _locked = null;
246:
247: public PropertyGroup lock(Object key) {
248: if (_locked == null)
249: _locked = new _Locked(key);
250: return _locked;
251: }
252:
253: public PropertyGroup lock() {
254: return lock(null);
255: }
256:
257: public NewPropertyGroup unlock(Object key) {
258: return this ;
259: }
260:
261: public Object clone() throws CloneNotSupportedException {
262: return new PersonPGImpl(PersonPGImpl.this );
263: }
264:
265: public PropertyGroup copy() {
266: try {
267: return (PropertyGroup) clone();
268: } catch (CloneNotSupportedException cnse) {
269: return null;
270: }
271: }
272:
273: public Class getPrimaryClass() {
274: return primaryClass;
275: }
276:
277: public String getAssetGetMethod() {
278: return assetGetter;
279: }
280:
281: public String getAssetSetMethod() {
282: return assetSetter;
283: }
284:
285: private final static PropertyDescriptor properties[] = new PropertyDescriptor[3];
286: static {
287: try {
288: properties[0] = new PropertyDescriptor("ID_code",
289: PersonPG.class, "getIDCode", null);
290: properties[1] = new PropertyDescriptor("nationality",
291: PersonPG.class, "getNationality", null);
292: properties[2] = new IndexedPropertyDescriptor("skills",
293: PersonPG.class, "getSkillsAsArray", null,
294: "getIndexedSkills", null);
295: } catch (Exception e) {
296: org.cougaar.util.log.Logging.getLogger(PersonPG.class)
297: .error("Caught exception", e);
298: }
299: }
300:
301: public PropertyDescriptor[] getPropertyDescriptors() {
302: return properties;
303: }
304:
305: private final class _Locked extends java.beans.SimpleBeanInfo
306: implements PersonPG, Cloneable, LockedPG {
307: private transient Object theKey = null;
308:
309: _Locked(Object key) {
310: if (this .theKey == null)
311: this .theKey = key;
312: }
313:
314: public _Locked() {
315: }
316:
317: public PropertyGroup lock() {
318: return this ;
319: }
320:
321: public PropertyGroup lock(Object o) {
322: return this ;
323: }
324:
325: public NewPropertyGroup unlock(Object key)
326: throws IllegalAccessException {
327: if (theKey.equals(key)) {
328: return PersonPGImpl.this ;
329: } else {
330: throw new IllegalAccessException(
331: "unlock: mismatched internal and provided keys!");
332: }
333: }
334:
335: public PropertyGroup copy() {
336: try {
337: return (PropertyGroup) clone();
338: } catch (CloneNotSupportedException cnse) {
339: return null;
340: }
341: }
342:
343: public Object clone() throws CloneNotSupportedException {
344: return new PersonPGImpl(PersonPGImpl.this );
345: }
346:
347: public boolean equals(Object object) {
348: return PersonPGImpl.this .equals(object);
349: }
350:
351: public String getIDCode() {
352: return PersonPGImpl.this .getIDCode();
353: }
354:
355: public String getNationality() {
356: return PersonPGImpl.this .getNationality();
357: }
358:
359: public Collection getSkills() {
360: return PersonPGImpl.this .getSkills();
361: }
362:
363: public boolean inSkills(Skill _element) {
364: return PersonPGImpl.this .inSkills(_element);
365: }
366:
367: public Skill[] getSkillsAsArray() {
368: return PersonPGImpl.this .getSkillsAsArray();
369: }
370:
371: public Skill getIndexedSkills(int _index) {
372: return PersonPGImpl.this .getIndexedSkills(_index);
373: }
374:
375: public final boolean hasDataQuality() {
376: return PersonPGImpl.this .hasDataQuality();
377: }
378:
379: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
380: return PersonPGImpl.this .getDataQuality();
381: }
382:
383: public Class getPrimaryClass() {
384: return primaryClass;
385: }
386:
387: public String getAssetGetMethod() {
388: return assetGetter;
389: }
390:
391: public String getAssetSetMethod() {
392: return assetSetter;
393: }
394:
395: public PropertyDescriptor[] getPropertyDescriptors() {
396: return properties;
397: }
398:
399: public Class getIntrospectionClass() {
400: return PersonPGImpl.class;
401: }
402:
403: }
404:
405: }
|