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