01: //THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: //CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: //BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: //OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: //LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: //OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: //EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: //POSSIBILITY OF SUCH DAMAGE.
13: //
14: //Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.applications.designstudio.userobjects;
16:
17: import com.metaboss.applications.designstudio.Application;
18: import com.metaboss.applications.designstudio.BaseUserObject;
19: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
20: import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
21: import com.metaboss.sdlctools.models.metabossmodel.ModelElementUtils;
22: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EnterpriseModelPackage;
23: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Event;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EventDataField;
25: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EventDataFieldClass;
26:
27: /* Event data field user object */
28:
29: public class EventDataFieldUserObject extends
30: AbstractDataFieldUserObject {
31: private EventDataField mField = null;
32:
33: public EventDataFieldUserObject(EventDataField pField) {
34: super (pField);
35: mField = pField;
36: }
37:
38: // create new service module
39: public static void addNewEventDataFieldField(Event pEvent)
40: throws Exception {
41: new EventDataFieldUserObject(null).addNewObject(
42: getObjectPackage(pEvent), pEvent.getDataFields());
43: }
44:
45: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
46: EnterpriseModelPackage lEnterpriseModelPackage = pPackage
47: .getEnterpriseModel();
48: EventDataFieldClass lClass = lEnterpriseModelPackage
49: .getEventDataField();
50: return new EventDataFieldUserObject(lClass
51: .createEventDataField());
52: }
53:
54: public EventDataField getField() {
55: return mField;
56: }
57:
58: // return master collection
59: protected ModelCollectionInfo extractMasterCollection() {
60: ModelCollectionInfo lResult = new ModelCollectionInfo(null,
61: null);
62: if (mField != null) {
63: Event lEvent = mField.getEvent();
64: if (lEvent != null) {
65: lResult.mCollection = ModelElementUtils
66: .getListOfModelElementsInAlphabeticalOrder(lEvent
67: .getDataFields());
68: lResult.mElement = lEvent;
69: }
70: }
71: return lResult;
72: }
73:
74: // duplicate model element
75: public ModelElement duplicate() throws Exception {
76: EventDataField lEventDataField = (EventDataField) Application.sModelRepository
77: .duplicateModelElement(mField);
78: lEventDataField.setEvent(mField.getEvent());
79: return lEventDataField;
80: }
81: }
|