1 package com.bonevich.erj.mof.impl.model;
2 import java.lang.reflect.Method;
3 import java.util.*;
4
5 public class ErjForeignKeyImpl extends com.bonevich.erj.mof.impl.model.ErjKeyConstraintImpl implements com.bonevich.erj.mof.interfaces.model.ForeignKey
6 {
7 public ErjForeignKeyImpl(ru.novosoft.mdf.impl.MDFOutermostPackageImpl r)
8 {
9 super(r);
10 }
11 protected void mdfReplaceData( ru.novosoft.mdf.ext.MDFObject srcarg, Class base)
12 {
13 super.mdfReplaceData(srcarg, base);
14 if (srcarg instanceof com.bonevich.erj.mof.interfaces.model.ForeignKey && com.bonevich.erj.mof.interfaces.model.ForeignKey.class.isAssignableFrom(base))
15 {
16 com.bonevich.erj.mof.impl.model.ErjForeignKeyImpl src = (com.bonevich.erj.mof.impl.model.ErjForeignKeyImpl)srcarg;
17 setCardinality(src.getCardinality());
18 {
19 List c = new ArrayList( src.getReferent113() );
20 src.getReferent113().clear();
21 collectionSetting(_referent113, c);
22 }
23 }
24 }
25 // implementing: com.bonevich.erj.mof.interfaces.model.ForeignKey
26 public java.util.List getReferent()
27 {
28 return getReferent113();
29 }
30 private java.util.List _referent113 = new ru.novosoft.mdf.impl.MDFFeatureListImpl( this, 105, true);
31 public java.util.List getReferent113()
32 {
33 checkExists();
34 return _referent113;
35 }
36 public Set mdfGetElementContents()
37 {
38 Set ret = super.mdfGetElementContents();
39 ret.remove( null );
40 return ret;
41 }
42 public Class mdfGetInterfaceClass()
43 {
44 return com.bonevich.erj.mof.interfaces.model.ForeignKey.class;
45 }
46 protected void cleanup()
47 {
48 _referent113.clear();
49 super.cleanup();
50 }
51 public void canBeElementAdded( ru.novosoft.mdf.impl.MDFListImpl list, int collectionId, Object newElement )
52 {
53 switch( collectionId )
54 {
55
56 case 105:
57 if (newElement == null)
58 {
59 throw new NullPointerException();
60 }
61 if (mdfGetOutermostPackage() != ((ru.novosoft.mdf.impl.MDFBaseObjectImpl)newElement).mdfGetOutermostPackage())
62 {
63 throw new javax.jmi.reflect.ClosureViolationException( null, null );
64 }
65 if (list.contains( newElement ))
66 {
67 throw new javax.jmi.reflect.DuplicateException( null, null);
68 }
69 if ( ! (newElement instanceof com.bonevich.erj.mof.interfaces.model.Relation) )
70 {
71 throw new javax.jmi.reflect.TypeMismatchException( null, null, null );
72 }
73 break;
74 default: super.canBeElementAdded( list, collectionId, newElement );
75 }
76 }
77 public void elementAdded( ru.novosoft.mdf.impl.MDFListImpl list, int collectionId, int position, Object newElement )
78 {
79 switch( collectionId )
80 {
81 case 105 :
82 {
83 ((com.bonevich.erj.mof.impl.model.ErjRelationImpl)newElement).internalRefByForeignKey114(this);
84 if (needUndo())
85 {
86 logItemAddAt((ru.novosoft.mdf.impl.MDFListImpl)_referent113,_addAtMethod, _removeAtMethod, newElement, position);
87 }
88 if ( needEvent() )
89 {
90 fireItemAddAt("referent", newElement, position);
91 }
92 }
93 break;
94 default: super.elementAdded( list, collectionId, position, newElement );
95 }
96 }
97 public void elementRemoved( ru.novosoft.mdf.impl.MDFListImpl list, int collectionId, int position, Object removedObject )
98 {
99 switch( collectionId )
100 {
101 case 105 :
102 {
103 ((com.bonevich.erj.mof.impl.model.ErjRelationImpl)removedObject).internalUnrefByForeignKey114(this);
104 if ( needUndo() )
105 {
106 logItemRemoveAt((ru.novosoft.mdf.impl.MDFListImpl)_referent113,_removeAtMethod, _addAtMethod, removedObject, position);
107 }
108 if ( needEvent() )
109 {
110 fireItemRemoveAt("referent", removedObject, position);
111 }
112 }
113 break;
114 default: super.elementRemoved( list, collectionId, position, removedObject );
115 }
116 }
117 public void elementSetAt(ru.novosoft.mdf.impl.MDFListImpl list, int collectionId, int position, Object removed, Object added)
118 {
119 switch(collectionId)
120 {
121 case 105:
122 {
123 ((com.bonevich.erj.mof.impl.model.ErjRelationImpl)added).internalRefByForeignKey114(this);
124 ((com.bonevich.erj.mof.impl.model.ErjRelationImpl)removed).internalUnrefByForeignKey114(this);
125 if (needUndo())
126 {
127 logItemSetAt((ru.novosoft.mdf.impl.MDFListImpl)_referent113,_setAtMethod, removed, added, position);
128 }
129 if ( needEvent() )
130 {
131 fireItemSetAt("referent", removed, added, position);
132 }
133 }
134 break;
135 }
136 }
137 public void mdfSetValue(String feature, Object value)
138 {
139 if ("cardinality".equals(feature))
140 {
141 setCardinality(((com.bonevich.erj.mof.interfaces.model.Cardinality)value));
142 return;
143 }
144 if ("referent".equals(feature))
145 {
146 collectionSetting(_referent113, (java.util.Collection)value);
147 return;
148 }
149 super.mdfSetValue(feature, value);
150 }
151 public Class mdfGetFeatureElementType(String k)
152 {
153 if ("referent".equals(k))
154 {
155 return com.bonevich.erj.mof.interfaces.model.Relation.class;
156 }
157 return super.mdfGetFeatureElementType(k);
158 }
159 public Class mdfGetFeatureType(String k)
160 {
161 if ("cardinality".equals(k))
162 {
163 return com.bonevich.erj.mof.interfaces.model.Cardinality.class;
164 }
165 if ("referent".equals(k))
166 {
167 return java.util.List.class;
168 }
169 return super.mdfGetFeatureType(k);
170 }
171 public Object mdfGetValue(String feature)
172 {
173 if ("cardinality".equals(feature))
174 {
175 return getCardinality();
176 }
177 if ("referent".equals(feature))
178 {
179 return getReferent113();
180 }
181 return super.mdfGetValue( feature );
182 }
183 public void mdfRemoveValue(String feature, Object existingValue)
184 {
185 if ("referent".equals(feature))
186 {
187 _referent113.remove(((com.bonevich.erj.mof.interfaces.model.Relation)existingValue));
188 return;
189 }
190 super.mdfRemoveValue(feature, existingValue);
191 }
192 private com.bonevich.erj.mof.interfaces.model.Cardinality _cardinality115 = null;
193 private final static Method _cardinality115_setMethod = mdfGetMethod1(com.bonevich.erj.mof.impl.model.ErjForeignKeyImpl.class, "setCardinality", com.bonevich.erj.mof.interfaces.model.Cardinality.class);
194 public final com.bonevich.erj.mof.interfaces.model.Cardinality getCardinality()
195 {
196 checkExists();
197 return ((com.bonevich.erj.mof.interfaces.model.Cardinality)_cardinality115);
198 }
199 public final void setCardinality(com.bonevich.erj.mof.interfaces.model.Cardinality newValue)
200 {
201 operationStarted();
202 try
203 {
204 if (_cardinality115 != ((com.bonevich.erj.mof.interfaces.model.Cardinality)newValue))
205 {
206 com.bonevich.erj.mof.interfaces.model.Cardinality __saved = _cardinality115;
207 _cardinality115 = ((com.bonevich.erj.mof.interfaces.model.Cardinality)newValue);
208 if (needUndo())
209 {
210 logPropertySet(_cardinality115_setMethod, __saved, ((com.bonevich.erj.mof.interfaces.model.Cardinality)newValue));
211 }
212 if (needEvent())
213 {
214 firePropertySet("cardinality", __saved, ((com.bonevich.erj.mof.interfaces.model.Cardinality)newValue));
215 }
216 }
217 }
218 finally
219 {
220 operationFinished();
221 }
222 }
223 public Object refGetValue(javax.jmi.reflect.RefObject feature)
224 {
225 if (ru.novosoft.mdf.impl.MDFBaseObjectImpl.checkQualifiedName( feature, "ErjInfoModel","ForeignKey","cardinality"))
226 {
227 return getCardinality();
228 }
229 if (ru.novosoft.mdf.impl.MDFBaseObjectImpl.checkQualifiedName( feature, "ErjInfoModel","ForeignKey","referent"))
230 {
231 return getReferent();
232 }
233 return super.refGetValue(feature);
234 }
235 public Object refGetValue(String feature)
236 {
237 return mdfGetValue(feature);
238 }
239 public void refSetValue(javax.jmi.reflect.RefObject feature, Object value)
240 {
241 if(ru.novosoft.mdf.impl.MDFBaseObjectImpl.checkQualifiedName( feature, "ErjInfoModel","ForeignKey","cardinality" ))
242 {
243 setCardinality((com.bonevich.erj.mof.interfaces.model.Cardinality) value);
244 }
245 else if(ru.novosoft.mdf.impl.MDFBaseObjectImpl.checkQualifiedName( feature, "ErjInfoModel","ForeignKey","referent" ))
246 {
247 collectionSetting(_referent113, (java.util.Collection)value);
248 }
249 else
250 {
251 super.refSetValue( feature, value );
252 }
253 }
254 public void refSetValue(String feature, Object value)
255 {
256 mdfSetValue(feature, value);
257 }
258 public Object refInvokeOperation(javax.jmi.reflect.RefObject requestedOperation, java.util.List args)
259 {
260 throw new RuntimeException(" !!! NOT IMPLEMENTED !!!");
261 }
262 public Object refInvokeOperation(String requestedOperation, java.util.List args)
263 {
264 throw new RuntimeException(" !!! NOT IMPLEMENTED !!!");
265 }
266 public javax.jmi.reflect.RefObject refMetaObject()
267 {
268 return refGetClass().refMetaObject();
269 }
270 public javax.jmi.reflect.RefPackage refImmediatePackage()
271 {
272 return refGetClass().refImmediatePackage();
273 }
274 public javax.jmi.reflect.RefPackage refOutermostPackage()
275 {
276 return refGetClass().refOutermostPackage();
277 }
278 public String refMofId()
279 {
280 throw new RuntimeException(" !!! NOT IMPLEMENTED !!!");
281 }
282 private ru.novosoft.mdf.ext.MDFClass thisCls = null;
283 public javax.jmi.reflect.RefClass refGetClass()
284 {
285 if (thisCls == null)
286 {
287 thisCls = (ru.novosoft.mdf.ext.MDFClass)repository.getMetaObject( com.bonevich.erj.mof.interfaces.model.ForeignKeyClass.class );
288 }
289 return thisCls;
290 }
291 public java.util.Collection refVerify( boolean f )
292 {
293 throw new RuntimeException(" !!! NOT IMPLEMENTED !!!");
294 }
295 public java.util.List internalGetOppositeCollection( int collectionId, Object o )
296 {
297 switch( collectionId )
298 {
299 }
300 return super.internalGetOppositeCollection( collectionId, o );
301 }
302 }
This page was automatically generated by Maven