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.enterprisemodel.AbstractOperation;
22: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EnterpriseModelPackage;
23: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.OperationInputField;
24: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.OperationInputFieldClass;
25:
26: /* Operation Input Field user object */
27:
28: public class OperationInputFieldUserObject extends
29: AbstractDataFieldUserObject {
30: OperationInputField mField = null;
31:
32: public OperationInputFieldUserObject(OperationInputField pField) {
33: super (pField);
34: mField = pField;
35: }
36:
37: // create new service module
38: public static void addNewOperationInputField(
39: AbstractOperation pOperation) throws Exception {
40: new OperationInputFieldUserObject(null).addNewObject(
41: getObjectPackage(pOperation), pOperation
42: .getInputFields());
43: }
44:
45: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
46: EnterpriseModelPackage lEnterpriseModelPackage = pPackage
47: .getEnterpriseModel();
48: OperationInputFieldClass lClass = lEnterpriseModelPackage
49: .getOperationInputField();
50: OperationInputField lOperationInputField = lClass
51: .createOperationInputField();
52: lOperationInputField.setArray(false);
53: return new OperationInputFieldUserObject(lOperationInputField);
54: }
55:
56: public OperationInputField getField() {
57: return mField;
58: }
59:
60: // return object root node captions
61: public String getRootNodeName() {
62: return Application.getString("inputfields_node");
63: }
64:
65: // return master collection
66: protected ModelCollectionInfo extractMasterCollection() {
67: ModelCollectionInfo lResult = new ModelCollectionInfo(null,
68: null);
69: if (mField != null) {
70: AbstractOperation lOperation = mField.getOperation();
71: if (lOperation != null) {
72: lResult.mCollection = lOperation.getInputFields();
73: lResult.mElement = lOperation;
74: }
75: }
76: return lResult;
77: }
78:
79: // duplicate model element
80: public ModelElement duplicate() throws Exception {
81: OperationInputField lField = (OperationInputField) Application.sModelRepository
82: .duplicateModelElement(mField);
83: lField.setOperation(mField.getOperation());
84: return lField;
85: }
86: }
|