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:46 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/glm/src/org/cougaar/glm/ldm/asset/alpassets.def - DO NOT HAND EDIT */
028: package org.cougaar.glm.ldm.asset;
029:
030: import org.cougaar.planning.ldm.asset.*;
031: import java.io.ObjectOutputStream;
032: import java.io.ObjectInputStream;
033: import java.io.IOException;
034: import java.util.Vector;
035: import java.beans.PropertyDescriptor;
036: import java.beans.IndexedPropertyDescriptor;
037: import java.beans.IntrospectionException;
038:
039: public class Inventory extends GLMAsset {
040:
041: public Inventory() {
042: myScheduledContentPG = null;
043: myInventoryLevelsPG = null;
044: myReportSchedulePG = null;
045: myInventoryPG = null;
046: }
047:
048: public Inventory(Inventory prototype) {
049: super (prototype);
050: myScheduledContentPG = null;
051: myInventoryLevelsPG = null;
052: myReportSchedulePG = null;
053: myInventoryPG = null;
054: }
055:
056: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
057: public Object clone() throws CloneNotSupportedException {
058: Inventory _thing = (Inventory) super .clone();
059: if (myScheduledContentPG != null)
060: _thing.setScheduledContentPG(myScheduledContentPG.lock());
061: if (myInventoryLevelsPG != null)
062: _thing.setInventoryLevelsPG(myInventoryLevelsPG.lock());
063: if (myReportSchedulePG != null)
064: _thing.setReportSchedulePG(myReportSchedulePG.lock());
065: if (myInventoryPG != null)
066: _thing.setInventoryPG(myInventoryPG.lock());
067: return _thing;
068: }
069:
070: /** create an instance of the right class for copy operations **/
071: public Asset instanceForCopy() {
072: return new Inventory();
073: }
074:
075: /** create an instance of this prototype **/
076: public Asset createInstance() {
077: return new Inventory(this );
078: }
079:
080: protected void fillAllPropertyGroups(Vector v) {
081: super .fillAllPropertyGroups(v);
082: {
083: Object _tmp = getScheduledContentPG();
084: if (_tmp != null && !(_tmp instanceof Null_PG)) {
085: v.addElement(_tmp);
086: }
087: }
088: {
089: Object _tmp = getInventoryLevelsPG();
090: if (_tmp != null && !(_tmp instanceof Null_PG)) {
091: v.addElement(_tmp);
092: }
093: }
094: {
095: Object _tmp = getReportSchedulePG();
096: if (_tmp != null && !(_tmp instanceof Null_PG)) {
097: v.addElement(_tmp);
098: }
099: }
100: {
101: Object _tmp = getInventoryPG();
102: if (_tmp != null && !(_tmp instanceof Null_PG)) {
103: v.addElement(_tmp);
104: }
105: }
106: }
107:
108: private transient ScheduledContentPG myScheduledContentPG;
109:
110: public ScheduledContentPG getScheduledContentPG() {
111: ScheduledContentPG _tmp = (myScheduledContentPG != null) ? myScheduledContentPG
112: : (ScheduledContentPG) resolvePG(ScheduledContentPG.class);
113: return (_tmp == ScheduledContentPG.nullPG) ? null : _tmp;
114: }
115:
116: public void setScheduledContentPG(
117: PropertyGroup arg_ScheduledContentPG) {
118: if (!(arg_ScheduledContentPG instanceof ScheduledContentPG))
119: throw new IllegalArgumentException(
120: "setScheduledContentPG requires a ScheduledContentPG argument.");
121: myScheduledContentPG = (ScheduledContentPG) arg_ScheduledContentPG;
122: }
123:
124: private transient InventoryLevelsPG myInventoryLevelsPG;
125:
126: public InventoryLevelsPG getInventoryLevelsPG() {
127: InventoryLevelsPG _tmp = (myInventoryLevelsPG != null) ? myInventoryLevelsPG
128: : (InventoryLevelsPG) resolvePG(InventoryLevelsPG.class);
129: return (_tmp == InventoryLevelsPG.nullPG) ? null : _tmp;
130: }
131:
132: public void setInventoryLevelsPG(PropertyGroup arg_InventoryLevelsPG) {
133: if (!(arg_InventoryLevelsPG instanceof InventoryLevelsPG))
134: throw new IllegalArgumentException(
135: "setInventoryLevelsPG requires a InventoryLevelsPG argument.");
136: myInventoryLevelsPG = (InventoryLevelsPG) arg_InventoryLevelsPG;
137: }
138:
139: private transient ReportSchedulePG myReportSchedulePG;
140:
141: public ReportSchedulePG getReportSchedulePG() {
142: ReportSchedulePG _tmp = (myReportSchedulePG != null) ? myReportSchedulePG
143: : (ReportSchedulePG) resolvePG(ReportSchedulePG.class);
144: return (_tmp == ReportSchedulePG.nullPG) ? null : _tmp;
145: }
146:
147: public void setReportSchedulePG(PropertyGroup arg_ReportSchedulePG) {
148: if (!(arg_ReportSchedulePG instanceof ReportSchedulePG))
149: throw new IllegalArgumentException(
150: "setReportSchedulePG requires a ReportSchedulePG argument.");
151: myReportSchedulePG = (ReportSchedulePG) arg_ReportSchedulePG;
152: }
153:
154: private transient InventoryPG myInventoryPG;
155:
156: public InventoryPG getInventoryPG() {
157: InventoryPG _tmp = (myInventoryPG != null) ? myInventoryPG
158: : (InventoryPG) resolvePG(InventoryPG.class);
159: return (_tmp == InventoryPG.nullPG) ? null : _tmp;
160: }
161:
162: public void setInventoryPG(PropertyGroup arg_InventoryPG) {
163: if (!(arg_InventoryPG instanceof InventoryPG))
164: throw new IllegalArgumentException(
165: "setInventoryPG requires a InventoryPG argument.");
166: myInventoryPG = (InventoryPG) arg_InventoryPG;
167: }
168:
169: // generic search methods
170: public PropertyGroup getLocalPG(Class c, long t) {
171: if (ScheduledContentPG.class.equals(c)) {
172: return (myScheduledContentPG == ScheduledContentPG.nullPG) ? null
173: : myScheduledContentPG;
174: }
175: if (InventoryLevelsPG.class.equals(c)) {
176: return (myInventoryLevelsPG == InventoryLevelsPG.nullPG) ? null
177: : myInventoryLevelsPG;
178: }
179: if (ReportSchedulePG.class.equals(c)) {
180: return (myReportSchedulePG == ReportSchedulePG.nullPG) ? null
181: : myReportSchedulePG;
182: }
183: if (InventoryPG.class.equals(c)) {
184: return (myInventoryPG == InventoryPG.nullPG) ? null
185: : myInventoryPG;
186: }
187: return super .getLocalPG(c, t);
188: }
189:
190: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
191: return super .getLocalPGSchedule(c);
192: }
193:
194: public void setLocalPG(Class c, PropertyGroup pg) {
195: if (ScheduledContentPG.class.equals(c)) {
196: myScheduledContentPG = (ScheduledContentPG) pg;
197: } else if (InventoryLevelsPG.class.equals(c)) {
198: myInventoryLevelsPG = (InventoryLevelsPG) pg;
199: } else if (ReportSchedulePG.class.equals(c)) {
200: myReportSchedulePG = (ReportSchedulePG) pg;
201: } else if (InventoryPG.class.equals(c)) {
202: myInventoryPG = (InventoryPG) pg;
203: } else
204: super .setLocalPG(c, pg);
205: }
206:
207: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
208: super .setLocalPGSchedule(pgSchedule);
209: }
210:
211: public PropertyGroup removeLocalPG(Class c) {
212: PropertyGroup removed = null;
213: if (ScheduledContentPG.class.equals(c)) {
214: removed = myScheduledContentPG;
215: myScheduledContentPG = null;
216: } else if (InventoryLevelsPG.class.equals(c)) {
217: removed = myInventoryLevelsPG;
218: myInventoryLevelsPG = null;
219: } else if (ReportSchedulePG.class.equals(c)) {
220: removed = myReportSchedulePG;
221: myReportSchedulePG = null;
222: } else if (InventoryPG.class.equals(c)) {
223: removed = myInventoryPG;
224: myInventoryPG = null;
225: } else {
226: removed = super .removeLocalPG(c);
227: }
228: return removed;
229: }
230:
231: public PropertyGroup removeLocalPG(PropertyGroup pg) {
232: Class pgc = pg.getPrimaryClass();
233: if (ScheduledContentPG.class.equals(pgc)) {
234: PropertyGroup removed = myScheduledContentPG;
235: myScheduledContentPG = null;
236: return removed;
237: } else if (InventoryLevelsPG.class.equals(pgc)) {
238: PropertyGroup removed = myInventoryLevelsPG;
239: myInventoryLevelsPG = null;
240: return removed;
241: } else if (ReportSchedulePG.class.equals(pgc)) {
242: PropertyGroup removed = myReportSchedulePG;
243: myReportSchedulePG = null;
244: return removed;
245: } else if (InventoryPG.class.equals(pgc)) {
246: PropertyGroup removed = myInventoryPG;
247: myInventoryPG = null;
248: return removed;
249: } else {
250: }
251: return super .removeLocalPG(pg);
252: }
253:
254: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
255: {
256: return super .removeLocalPGSchedule(c);
257: }
258: }
259:
260: public PropertyGroup generateDefaultPG(Class c) {
261: if (ScheduledContentPG.class.equals(c)) {
262: return (myScheduledContentPG = new ScheduledContentPGImpl());
263: } else if (InventoryLevelsPG.class.equals(c)) {
264: return (myInventoryLevelsPG = new InventoryLevelsPGImpl());
265: } else if (ReportSchedulePG.class.equals(c)) {
266: return (myReportSchedulePG = new ReportSchedulePGImpl());
267: } else if (InventoryPG.class.equals(c)) {
268: return (myInventoryPG = new InventoryPGImpl());
269: } else
270: return super .generateDefaultPG(c);
271: }
272:
273: // dumb serialization methods
274:
275: private void writeObject(ObjectOutputStream out) throws IOException {
276: out.defaultWriteObject();
277: if (myScheduledContentPG instanceof Null_PG
278: || myScheduledContentPG instanceof Future_PG) {
279: out.writeObject(null);
280: } else {
281: out.writeObject(myScheduledContentPG);
282: }
283: if (myInventoryLevelsPG instanceof Null_PG
284: || myInventoryLevelsPG instanceof Future_PG) {
285: out.writeObject(null);
286: } else {
287: out.writeObject(myInventoryLevelsPG);
288: }
289: if (myReportSchedulePG instanceof Null_PG
290: || myReportSchedulePG instanceof Future_PG) {
291: out.writeObject(null);
292: } else {
293: out.writeObject(myReportSchedulePG);
294: }
295: if (myInventoryPG instanceof Null_PG
296: || myInventoryPG instanceof Future_PG) {
297: out.writeObject(null);
298: } else {
299: out.writeObject(myInventoryPG);
300: }
301: }
302:
303: private void readObject(ObjectInputStream in)
304: throws ClassNotFoundException, IOException {
305: in.defaultReadObject();
306: myScheduledContentPG = (ScheduledContentPG) in.readObject();
307: myInventoryLevelsPG = (InventoryLevelsPG) in.readObject();
308: myReportSchedulePG = (ReportSchedulePG) in.readObject();
309: myInventoryPG = (InventoryPG) in.readObject();
310: }
311:
312: // beaninfo support
313: private static PropertyDescriptor properties[];
314: static {
315: try {
316: properties = new PropertyDescriptor[4];
317: properties[0] = new PropertyDescriptor(
318: "ScheduledContentPG", Inventory.class,
319: "getScheduledContentPG", null);
320: properties[1] = new PropertyDescriptor("InventoryLevelsPG",
321: Inventory.class, "getInventoryLevelsPG", null);
322: properties[2] = new PropertyDescriptor("ReportSchedulePG",
323: Inventory.class, "getReportSchedulePG", null);
324: properties[3] = new PropertyDescriptor("InventoryPG",
325: Inventory.class, "getInventoryPG", null);
326: } catch (IntrospectionException ie) {
327: }
328: }
329:
330: public PropertyDescriptor[] getPropertyDescriptors() {
331: PropertyDescriptor[] pds = super .getPropertyDescriptors();
332: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 4];
333: System.arraycopy(pds, 0, ps, 0, pds.length);
334: System.arraycopy(properties, 0, ps, pds.length, 4);
335: return ps;
336: }
337: }
|