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.RelationalReferenceTablePropertiesDialog;
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.RelationalReferenceTable;
025: import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.domainimplementationmodel.RelationalReferenceTableClass;
026:
027: /* RelationalReferenceTable user object */
028:
029: public class RelationalReferenceTableUserObject extends BaseUserObject {
030: private RelationalReferenceTable mRelationalReferenceTable = null;
031:
032: public RelationalReferenceTableUserObject(
033: RelationalReferenceTable pRelationalReferenceTable) {
034: super (pRelationalReferenceTable, Application.TABLE_ICON);
035: mRelationalReferenceTable = pRelationalReferenceTable;
036: }
037:
038: public RelationalReferenceTableUserObject(
039: RelationalReferenceTable pRelationalReferenceTable,
040: String pCaption, int pMode) {
041: super (pRelationalReferenceTable, pCaption, pMode);
042: mRelationalReferenceTable = pRelationalReferenceTable;
043: }
044:
045: public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
046: RelationalReferenceTableClass lClass = pPackage
047: .getEnterpriseModel().getSystemImplementationModel()
048: .getDomainImplementationModel()
049: .getRelationalReferenceTable();
050: return new RelationalReferenceTableUserObject(lClass
051: .createRelationalReferenceTable());
052: }
053:
054: public static void addNewReferenceTable(
055: DomainRelationalStorageDefinition pStorageDefinition)
056: throws Exception {
057: new RelationalReferenceTableUserObject(null).addNewObject(
058: getObjectPackage(pStorageDefinition),
059: pStorageDefinition.getReferenceTables());
060: }
061:
062: // return object root node captions
063: public String getRootNodeName() {
064: return Application.getString("relationaltables_node");
065: }
066:
067: // load object properties into grid control
068: public void loadObjectProperties(PropertiesTableModel pModel)
069: throws Exception {
070: super .loadObjectProperties(pModel);
071: if (pModel == null || mRelationalReferenceTable == null)
072: return;
073:
074: addModelElement(pModel, "DataType", mRelationalReferenceTable
075: .getDataType());
076: pModel.AddProperty("Table Alias", mRelationalReferenceTable
077: .getTableAlias());
078: pModel.AddProperty("Description Column Name Override",
079: mRelationalReferenceTable
080: .getDescriptionColumnNameOverride());
081: pModel.AddProperty("Description Column Name Suggestion",
082: mRelationalReferenceTable
083: .getDescriptionColumnNameSuggestion());
084: pModel.AddProperty("Name Override", mRelationalReferenceTable
085: .getNameOverride());
086: pModel.AddProperty("Name Suggestion", mRelationalReferenceTable
087: .getNameSuggestion());
088: pModel.AddProperty("Primary Key Constraint Name Override",
089: mRelationalReferenceTable
090: .getPrimaryKeyConstraintNameOverride());
091: pModel.AddProperty("Primary Key Constraint Name Suggestion",
092: mRelationalReferenceTable
093: .getPrimaryKeyConstraintNameSuggestion());
094: pModel.AddProperty("Value Column Name Override",
095: mRelationalReferenceTable.getValueColumnNameOverride());
096: pModel.AddProperty("Value Column Name Suggestion",
097: mRelationalReferenceTable
098: .getValueColumnNameSuggestion());
099: pModel
100: .AddProperty("Weight Column Name Override",
101: mRelationalReferenceTable
102: .getWeightColumnNameOverride());
103: pModel.AddProperty("Weight Column Name Suggestion",
104: mRelationalReferenceTable
105: .getWeightColumnNameSuggestion());
106: pModel.AddProperty("Weight Constraint Name Override",
107: mRelationalReferenceTable
108: .getWeightConstraintNameOverride());
109: pModel.AddProperty("Weight Constraint Name Suggestion",
110: mRelationalReferenceTable
111: .getWeightConstraintNameSuggestion());
112: pModel.AddProperty("Has Comparison Mechanism",
113: boolToString(mRelationalReferenceTable
114: .isHasComparisonMechanism()));
115: }
116:
117: public BasePropertiesDialog getObjectEditor() {
118: return new RelationalReferenceTablePropertiesDialog();
119: }
120: }
|