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: /** A standard-sized box that can be placed on flatbed trailer, train or ship. This refers to a very specific class of object, not the generic "container". See "Package" instead. **/
040:
041: public class Container extends ClassVIIMajorEndItem {
042:
043: public Container() {
044: myScheduledContentPG = null;
045: myContainPG = null;
046: }
047:
048: public Container(Container prototype) {
049: super (prototype);
050: myScheduledContentPG = null;
051: myContainPG = null;
052: }
053:
054: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
055: public Object clone() throws CloneNotSupportedException {
056: Container _thing = (Container) super .clone();
057: if (myScheduledContentPG != null)
058: _thing.setScheduledContentPG(myScheduledContentPG.lock());
059: if (myContainPG != null)
060: _thing.setContainPG(myContainPG.lock());
061: return _thing;
062: }
063:
064: /** create an instance of the right class for copy operations **/
065: public Asset instanceForCopy() {
066: return new Container();
067: }
068:
069: /** create an instance of this prototype **/
070: public Asset createInstance() {
071: return new Container(this );
072: }
073:
074: protected void fillAllPropertyGroups(Vector v) {
075: super .fillAllPropertyGroups(v);
076: {
077: Object _tmp = getScheduledContentPG();
078: if (_tmp != null && !(_tmp instanceof Null_PG)) {
079: v.addElement(_tmp);
080: }
081: }
082: {
083: Object _tmp = getContainPG();
084: if (_tmp != null && !(_tmp instanceof Null_PG)) {
085: v.addElement(_tmp);
086: }
087: }
088: }
089:
090: private transient ScheduledContentPG myScheduledContentPG;
091:
092: public ScheduledContentPG getScheduledContentPG() {
093: ScheduledContentPG _tmp = (myScheduledContentPG != null) ? myScheduledContentPG
094: : (ScheduledContentPG) resolvePG(ScheduledContentPG.class);
095: return (_tmp == ScheduledContentPG.nullPG) ? null : _tmp;
096: }
097:
098: public void setScheduledContentPG(
099: PropertyGroup arg_ScheduledContentPG) {
100: if (!(arg_ScheduledContentPG instanceof ScheduledContentPG))
101: throw new IllegalArgumentException(
102: "setScheduledContentPG requires a ScheduledContentPG argument.");
103: myScheduledContentPG = (ScheduledContentPG) arg_ScheduledContentPG;
104: }
105:
106: private transient ContainPG myContainPG;
107:
108: public ContainPG getContainPG() {
109: ContainPG _tmp = (myContainPG != null) ? myContainPG
110: : (ContainPG) resolvePG(ContainPG.class);
111: return (_tmp == ContainPG.nullPG) ? null : _tmp;
112: }
113:
114: public void setContainPG(PropertyGroup arg_ContainPG) {
115: if (!(arg_ContainPG instanceof ContainPG))
116: throw new IllegalArgumentException(
117: "setContainPG requires a ContainPG argument.");
118: myContainPG = (ContainPG) arg_ContainPG;
119: }
120:
121: // generic search methods
122: public PropertyGroup getLocalPG(Class c, long t) {
123: if (ScheduledContentPG.class.equals(c)) {
124: return (myScheduledContentPG == ScheduledContentPG.nullPG) ? null
125: : myScheduledContentPG;
126: }
127: if (ContainPG.class.equals(c)) {
128: return (myContainPG == ContainPG.nullPG) ? null
129: : myContainPG;
130: }
131: return super .getLocalPG(c, t);
132: }
133:
134: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
135: return super .getLocalPGSchedule(c);
136: }
137:
138: public void setLocalPG(Class c, PropertyGroup pg) {
139: if (ScheduledContentPG.class.equals(c)) {
140: myScheduledContentPG = (ScheduledContentPG) pg;
141: } else if (ContainPG.class.equals(c)) {
142: myContainPG = (ContainPG) pg;
143: } else
144: super .setLocalPG(c, pg);
145: }
146:
147: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
148: super .setLocalPGSchedule(pgSchedule);
149: }
150:
151: public PropertyGroup removeLocalPG(Class c) {
152: PropertyGroup removed = null;
153: if (ScheduledContentPG.class.equals(c)) {
154: removed = myScheduledContentPG;
155: myScheduledContentPG = null;
156: } else if (ContainPG.class.equals(c)) {
157: removed = myContainPG;
158: myContainPG = null;
159: } else {
160: removed = super .removeLocalPG(c);
161: }
162: return removed;
163: }
164:
165: public PropertyGroup removeLocalPG(PropertyGroup pg) {
166: Class pgc = pg.getPrimaryClass();
167: if (ScheduledContentPG.class.equals(pgc)) {
168: PropertyGroup removed = myScheduledContentPG;
169: myScheduledContentPG = null;
170: return removed;
171: } else if (ContainPG.class.equals(pgc)) {
172: PropertyGroup removed = myContainPG;
173: myContainPG = null;
174: return removed;
175: } else {
176: }
177: return super .removeLocalPG(pg);
178: }
179:
180: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
181: {
182: return super .removeLocalPGSchedule(c);
183: }
184: }
185:
186: public PropertyGroup generateDefaultPG(Class c) {
187: if (ScheduledContentPG.class.equals(c)) {
188: return (myScheduledContentPG = new ScheduledContentPGImpl());
189: } else if (ContainPG.class.equals(c)) {
190: return (myContainPG = new ContainPGImpl());
191: } else
192: return super .generateDefaultPG(c);
193: }
194:
195: // dumb serialization methods
196:
197: private void writeObject(ObjectOutputStream out) throws IOException {
198: out.defaultWriteObject();
199: if (myScheduledContentPG instanceof Null_PG
200: || myScheduledContentPG instanceof Future_PG) {
201: out.writeObject(null);
202: } else {
203: out.writeObject(myScheduledContentPG);
204: }
205: if (myContainPG instanceof Null_PG
206: || myContainPG instanceof Future_PG) {
207: out.writeObject(null);
208: } else {
209: out.writeObject(myContainPG);
210: }
211: }
212:
213: private void readObject(ObjectInputStream in)
214: throws ClassNotFoundException, IOException {
215: in.defaultReadObject();
216: myScheduledContentPG = (ScheduledContentPG) in.readObject();
217: myContainPG = (ContainPG) in.readObject();
218: }
219:
220: // beaninfo support
221: private static PropertyDescriptor properties[];
222: static {
223: try {
224: properties = new PropertyDescriptor[2];
225: properties[0] = new PropertyDescriptor(
226: "ScheduledContentPG", Container.class,
227: "getScheduledContentPG", null);
228: properties[1] = new PropertyDescriptor("ContainPG",
229: Container.class, "getContainPG", null);
230: } catch (IntrospectionException ie) {
231: }
232: }
233:
234: public PropertyDescriptor[] getPropertyDescriptors() {
235: PropertyDescriptor[] pds = super .getPropertyDescriptors();
236: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 2];
237: System.arraycopy(pds, 0, ps, 0, pds.length);
238: System.arraycopy(properties, 0, ps, pds.length, 2);
239: return ps;
240: }
241: }
|