001: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012: // POSSIBILITY OF SUCH DAMAGE.
013: //
014: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015: package com.metaboss.applications.designstudio.userobjects;
016:
017: import com.metaboss.applications.designstudio.Application;
018: import com.metaboss.applications.designstudio.BasePropertiesDialog;
019: import com.metaboss.applications.designstudio.BaseUserObject;
020: import com.metaboss.applications.designstudio.propertiesdialogs.RelationalAssociationTablePropertiesDialog;
021: import com.metaboss.applications.designstudio.propertiesview.PropertiesTableModel;
022: import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
023: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.DomainRelationalStorageDefinition;
024: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.RelationalAssociationTable;
025: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.RelationalAssociationTableClass;
026:
027: /* RelationalAssociationTable user object */
028:
029: public class RelationalAssociationTableUserObject extends
030: BaseUserObject {
031: private RelationalAssociationTable mRelationalAssociationTable = null;
032:
033: public RelationalAssociationTableUserObject(
034: RelationalAssociationTable pRelationalAssociationTable) {
035: super (pRelationalAssociationTable,
036: Application.ASSOCIATIONTABLE_ICON);
037: mRelationalAssociationTable = pRelationalAssociationTable;
038: }
039:
040: public RelationalAssociationTableUserObject(
041: RelationalAssociationTable pRelationalAssociationTable,
042: String pCaption, int pMode) {
043: super (pRelationalAssociationTable, pCaption, pMode);
044: mRelationalAssociationTable = pRelationalAssociationTable;
045: }
046:
047: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
048: RelationalAssociationTableClass lClass = pPackage
049: .getEnterpriseModel().getSystemImplementationModel()
050: .getDomainImplementationModel()
051: .getRelationalAssociationTable();
052: return new RelationalAssociationTableUserObject(lClass
053: .createRelationalAssociationTable());
054: }
055:
056: public static void addNewAssociationTable(
057: DomainRelationalStorageDefinition pStorageDefinition)
058: throws Exception {
059: new RelationalAssociationTableUserObject(null).addNewObject(
060: getObjectPackage(pStorageDefinition),
061: pStorageDefinition.getAssociationTables());
062: }
063:
064: // return object root node captions
065: public String getRootNodeName() {
066: return Application.getString("associationtables_node");
067: }
068:
069: // load object properties into grid control
070: public void loadObjectProperties(PropertiesTableModel pModel)
071: throws Exception {
072: super .loadObjectProperties(pModel);
073: if (pModel == null || mRelationalAssociationTable == null)
074: return;
075:
076: addModelElement(pModel, "Association",
077: mRelationalAssociationTable.getAssociation());
078: pModel.AddProperty("Table Alias", mRelationalAssociationTable
079: .getTableAlias());
080: pModel.AddProperty("First Role Column Name Override",
081: mRelationalAssociationTable
082: .getFirstRoleColumnNameOverride());
083: pModel.AddProperty("First Role Column Name Suggestion",
084: mRelationalAssociationTable
085: .getFirstRoleColumnNameSuggestion());
086: pModel
087: .AddProperty(
088: "First Role Referential Constraint Name Override",
089: mRelationalAssociationTable
090: .getFirstRoleReferentialConstraintNameOverride());
091: pModel
092: .AddProperty(
093: "First Role Referential Constraint Name Suggestion",
094: mRelationalAssociationTable
095: .getFirstRoleReferentialConstraintNameSuggestion());
096: pModel.AddProperty("Name Override", mRelationalAssociationTable
097: .getNameOverride());
098: pModel.AddProperty("Name Suggestion",
099: mRelationalAssociationTable.getNameSuggestion());
100: pModel.AddProperty("Primary Key Constraint Name Override",
101: mRelationalAssociationTable
102: .getPrimaryKeyConstraintNameOverride());
103: pModel.AddProperty("Primary Key Constraint Name Suggestion",
104: mRelationalAssociationTable
105: .getPrimaryKeyConstraintNameSuggestion());
106: pModel.AddProperty("Second Role Column Name Override",
107: mRelationalAssociationTable
108: .getSecondRoleColumnNameOverride());
109: pModel.AddProperty("Second Role Column Name Suggestion",
110: mRelationalAssociationTable
111: .getSecondRoleColumnNameSuggestion());
112: pModel
113: .AddProperty(
114: "Second Role Referential Constraint Name Override",
115: mRelationalAssociationTable
116: .getSecondRoleReferentialConstraintNameOverride());
117: pModel
118: .AddProperty(
119: "Second Role Referential Constraint Name Suggestion",
120: mRelationalAssociationTable
121: .getSecondRoleReferentialConstraintNameSuggestion());
122: }
123:
124: public BasePropertiesDialog getObjectEditor() {
125: return new RelationalAssociationTablePropertiesDialog();
126: }
127: }
|