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 OrganizationPG.
029: * @see OrganizationPG
030: * @see NewOrganizationPG
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 OrganizationPGImpl extends java.beans.SimpleBeanInfo
051: implements NewOrganizationPG, Cloneable {
052: public OrganizationPGImpl() {
053: }
054:
055: // Slots
056:
057: private Service theService;
058:
059: public Service getService() {
060: return theService;
061: }
062:
063: public void setService(Service service) {
064: theService = service;
065: }
066:
067: private Agency theAgency;
068:
069: public Agency getAgency() {
070: return theAgency;
071: }
072:
073: public void setAgency(Agency agency) {
074: theAgency = agency;
075: }
076:
077: private Collection theRoles;
078:
079: public Collection getRoles() {
080: return theRoles;
081: }
082:
083: public boolean inRoles(Role _element) {
084: return (theRoles == null) ? false : (theRoles
085: .contains(_element));
086: }
087:
088: public Role[] getRolesAsArray() {
089: if (theRoles == null)
090: return new Role[0];
091: int l = theRoles.size();
092: Role[] v = new Role[l];
093: int i = 0;
094: for (Iterator n = theRoles.iterator(); n.hasNext();) {
095: v[i] = (Role) n.next();
096: i++;
097: }
098: return v;
099: }
100:
101: public Role getIndexedRoles(int _index) {
102: if (theRoles == null)
103: return null;
104: for (Iterator _i = theRoles.iterator(); _i.hasNext();) {
105: Role _e = (Role) _i.next();
106: if (_index == 0)
107: return _e;
108: _index--;
109: }
110: return null;
111: }
112:
113: public void setRoles(Collection roles) {
114: theRoles = roles;
115: }
116:
117: public void clearRoles() {
118: theRoles.clear();
119: }
120:
121: public boolean removeFromRoles(Role _element) {
122: return theRoles.remove(_element);
123: }
124:
125: public boolean addToRoles(Role _element) {
126: return theRoles.add(_element);
127: }
128:
129: public OrganizationPGImpl(OrganizationPG original) {
130: theService = original.getService();
131: theAgency = original.getAgency();
132: theRoles = original.getRoles();
133: }
134:
135: public boolean equals(Object other) {
136:
137: if (!(other instanceof OrganizationPG)) {
138: return false;
139: }
140:
141: OrganizationPG otherOrganizationPG = (OrganizationPG) other;
142:
143: if (getService() == null) {
144: if (otherOrganizationPG.getService() != null) {
145: return false;
146: }
147: } else if (!(getService().equals(otherOrganizationPG
148: .getService()))) {
149: return false;
150: }
151:
152: if (getAgency() == null) {
153: if (otherOrganizationPG.getAgency() != null) {
154: return false;
155: }
156: } else if (!(getAgency()
157: .equals(otherOrganizationPG.getAgency()))) {
158: return false;
159: }
160:
161: if (getRoles() == null) {
162: if (otherOrganizationPG.getRoles() != null) {
163: return false;
164: }
165: } else if (!(getRoles().equals(otherOrganizationPG.getRoles()))) {
166: return false;
167: }
168:
169: return true;
170: }
171:
172: public boolean hasDataQuality() {
173: return false;
174: }
175:
176: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
177: return null;
178: }
179:
180: // static inner extension class for real DataQuality Support
181: public final static class DQ extends OrganizationPGImpl implements
182: org.cougaar.planning.ldm.dq.NewHasDataQuality {
183: public DQ() {
184: super ();
185: }
186:
187: public DQ(OrganizationPG original) {
188: super (original);
189: }
190:
191: public Object clone() {
192: return new DQ(this );
193: }
194:
195: private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null;
196:
197: public boolean hasDataQuality() {
198: return (_dq != null);
199: }
200:
201: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
202: return _dq;
203: }
204:
205: public void setDataQuality(
206: org.cougaar.planning.ldm.dq.DataQuality dq) {
207: _dq = dq;
208: }
209:
210: private void writeObject(ObjectOutputStream out)
211: throws IOException {
212: out.defaultWriteObject();
213: if (out instanceof org.cougaar.core.persist.PersistenceOutputStream)
214: out.writeObject(_dq);
215: }
216:
217: private void readObject(ObjectInputStream in)
218: throws ClassNotFoundException, IOException {
219: in.defaultReadObject();
220: if (in instanceof org.cougaar.core.persist.PersistenceInputStream)
221: _dq = (org.cougaar.planning.ldm.dq.DataQuality) in
222: .readObject();
223: }
224:
225: private final static PropertyDescriptor properties[] = new PropertyDescriptor[1];
226: static {
227: try {
228: properties[0] = new PropertyDescriptor("dataQuality",
229: DQ.class, "getDataQuality", null);
230: } catch (Exception e) {
231: e.printStackTrace();
232: }
233: }
234:
235: public PropertyDescriptor[] getPropertyDescriptors() {
236: PropertyDescriptor[] pds = super .properties;
237: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length
238: + properties.length];
239: System.arraycopy(pds, 0, ps, 0, pds.length);
240: System.arraycopy(properties, 0, ps, pds.length,
241: properties.length);
242: return ps;
243: }
244: }
245:
246: private transient OrganizationPG _locked = null;
247:
248: public PropertyGroup lock(Object key) {
249: if (_locked == null)
250: _locked = new _Locked(key);
251: return _locked;
252: }
253:
254: public PropertyGroup lock() {
255: return lock(null);
256: }
257:
258: public NewPropertyGroup unlock(Object key) {
259: return this ;
260: }
261:
262: public Object clone() throws CloneNotSupportedException {
263: return new OrganizationPGImpl(OrganizationPGImpl.this );
264: }
265:
266: public PropertyGroup copy() {
267: try {
268: return (PropertyGroup) clone();
269: } catch (CloneNotSupportedException cnse) {
270: return null;
271: }
272: }
273:
274: public Class getPrimaryClass() {
275: return primaryClass;
276: }
277:
278: public String getAssetGetMethod() {
279: return assetGetter;
280: }
281:
282: public String getAssetSetMethod() {
283: return assetSetter;
284: }
285:
286: private final static PropertyDescriptor properties[] = new PropertyDescriptor[3];
287: static {
288: try {
289: properties[0] = new PropertyDescriptor("service",
290: OrganizationPG.class, "getService", null);
291: properties[1] = new PropertyDescriptor("agency",
292: OrganizationPG.class, "getAgency", null);
293: properties[2] = new IndexedPropertyDescriptor("roles",
294: OrganizationPG.class, "getRolesAsArray", null,
295: "getIndexedRoles", null);
296: } catch (Exception e) {
297: org.cougaar.util.log.Logging
298: .getLogger(OrganizationPG.class).error(
299: "Caught exception", e);
300: }
301: }
302:
303: public PropertyDescriptor[] getPropertyDescriptors() {
304: return properties;
305: }
306:
307: private final class _Locked extends java.beans.SimpleBeanInfo
308: implements OrganizationPG, Cloneable, LockedPG {
309: private transient Object theKey = null;
310:
311: _Locked(Object key) {
312: if (this .theKey == null)
313: this .theKey = key;
314: }
315:
316: public _Locked() {
317: }
318:
319: public PropertyGroup lock() {
320: return this ;
321: }
322:
323: public PropertyGroup lock(Object o) {
324: return this ;
325: }
326:
327: public NewPropertyGroup unlock(Object key)
328: throws IllegalAccessException {
329: if (theKey.equals(key)) {
330: return OrganizationPGImpl.this ;
331: } else {
332: throw new IllegalAccessException(
333: "unlock: mismatched internal and provided keys!");
334: }
335: }
336:
337: public PropertyGroup copy() {
338: try {
339: return (PropertyGroup) clone();
340: } catch (CloneNotSupportedException cnse) {
341: return null;
342: }
343: }
344:
345: public Object clone() throws CloneNotSupportedException {
346: return new OrganizationPGImpl(OrganizationPGImpl.this );
347: }
348:
349: public boolean equals(Object object) {
350: return OrganizationPGImpl.this .equals(object);
351: }
352:
353: public Service getService() {
354: return OrganizationPGImpl.this .getService();
355: }
356:
357: public Agency getAgency() {
358: return OrganizationPGImpl.this .getAgency();
359: }
360:
361: public Collection getRoles() {
362: return OrganizationPGImpl.this .getRoles();
363: }
364:
365: public boolean inRoles(Role _element) {
366: return OrganizationPGImpl.this .inRoles(_element);
367: }
368:
369: public Role[] getRolesAsArray() {
370: return OrganizationPGImpl.this .getRolesAsArray();
371: }
372:
373: public Role getIndexedRoles(int _index) {
374: return OrganizationPGImpl.this .getIndexedRoles(_index);
375: }
376:
377: public final boolean hasDataQuality() {
378: return OrganizationPGImpl.this .hasDataQuality();
379: }
380:
381: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
382: return OrganizationPGImpl.this .getDataQuality();
383: }
384:
385: public Class getPrimaryClass() {
386: return primaryClass;
387: }
388:
389: public String getAssetGetMethod() {
390: return assetGetter;
391: }
392:
393: public String getAssetSetMethod() {
394: return assetSetter;
395: }
396:
397: public PropertyDescriptor[] getPropertyDescriptors() {
398: return properties;
399: }
400:
401: public Class getIntrospectionClass() {
402: return OrganizationPGImpl.class;
403: }
404:
405: }
406:
407: }
|