/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbSMSStructuralFeature.metaClass); metaClass.setIcon("dboodatamember.gif"); fAssociationEnd.setJField(DbOODataMember.class.getDeclaredField("m_associationEnd")); fAssociationEnd.setVisibleInScreen(false); fVisibility.setJField(DbOODataMember.class.getDeclaredField("m_visibility")); fVisibility.setScreenOrder("<initialValue"); fType.setJField(DbOODataMember.class.getDeclaredField("m_type")); fType.setFlags(MetaField.COPY_REFS | MetaField.INTEGRABLE_BY_NAME); fType.setRendererPluginName("DbFullNameInTip;DbOOAdt"); fElementType.setJField(DbOODataMember.class.getDeclaredField("m_elementType")); fElementType.setFlags(MetaField.COPY_REFS | MetaField.INTEGRABLE_BY_NAME); fTypeUse.setJField(DbOODataMember.class.getDeclaredField("m_typeUse")); fTypeUseStyle.setJField(DbOODataMember.class.getDeclaredField("m_typeUseStyle")); fStatic.setJField(DbOODataMember.class.getDeclaredField("m_static")); fCommonItem.setJField(DbOODataMember.class.getDeclaredField("m_commonItem")); fDomain.setJField(DbOODataMember.class.getDeclaredField("m_domain")); fAssociationEnd.setOppositeRel(DbOOAssociationEnd.fAssociationMember); fType.setOppositeRel(DbOOAdt.fTypedDataMembers); fElementType.setOppositeRel(DbOOAdt.fTypedElementDataMembers); fCommonItem.setOppositeRel(DbORCommonItem.fFields); fDomain.setOppositeRel(DbORDomain.fFields); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
public DbObject createDbObject( MetaClass abstractMetaClass, DbObject composite, Object[] parameters) throws DbException { DbObject dbObject = null; if (composite != null) { if (abstractMetaClass.equals(DbORView.metaClass)) { dbObject = composite.createComponent(DbORAView.metaClass); } else if (abstractMetaClass.equals(DbORTable.metaClass)) { dbObject = composite.createComponent(DbORATable.metaClass); } else if (abstractMetaClass.equals(DbORTrigger.metaClass)) { dbObject = composite.createComponent(DbORATrigger.metaClass); } else if (abstractMetaClass.equals(DbORColumn.metaClass)) { dbObject = composite.createComponent(DbORAColumn.metaClass); } else if (abstractMetaClass.equals(DbORCheck.metaClass)) { dbObject = composite.createComponent(DbORACheck.metaClass); } else if (abstractMetaClass.equals(DbORPrimaryUnique.metaClass)) { dbObject = composite.createComponent(DbORAPrimaryUnique.metaClass); } else if (abstractMetaClass.equals(DbORIndex.metaClass)) { dbObject = composite.createComponent(DbORAIndex.metaClass); } else if (abstractMetaClass.equals(DbORDataModel.metaClass)) { DbORDataModel dataModel = (DbORDataModel) composite; return new DbORADataModel( composite, dataModel.getTargetSystem(), dataModel.getOperationalMode()); } else { dbObject = super.createDbObject(abstractMetaClass, composite, parameters); } // end if } return dbObject; } // end createDbObject()
/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbSMSSemanticalObject.metaClass); metaClass.setIcon("dborapartition.gif"); fTablespace.setJField(DbORAAbsPartition.class.getDeclaredField("m_tablespace")); fTablespace.setFlags(MetaField.INTEGRABLE_BY_NAME); fTablespace.setRendererPluginName("DbORATablespace"); fTablespace.setOppositeRel(DbORATablespace.fAbsPartitions); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
/** @return metaclass */ public MetaClass getStereotypeMetaClass() throws DbException { if (stereotypeMetaClass == null) { stereotypeMetaClass = MetaClass.find(getMetaClassName()); if (stereotypeMetaClass == null) return DbSMSSemanticalObject.metaClass; } return stereotypeMetaClass; }
/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbORTrigger.metaClass); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbSMSAssociationGo.metaClass); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
/** * @param name java.lang.String * @return metafield */ public final MetaField getMetaField(String name) { if (fieldMap == null) { MetaField[] fields = metaClass.getAllMetaFields(); fieldMap = new HashMap(fields.length + fields.length / 2); for (int i = 0; i < fields.length; i++) fieldMap.put(fields[i].getJName(), fields[i]); } return (MetaField) fieldMap.get(name); }
private ObjectScope getObjectScope(ObjectScope[] scope, String metaclassname) { MetaClass metaclass = MetaClass.find(metaclassname); if (metaclass == null) // obsolete metaClass return null; for (int i = 0; i < scope.length; i++) { if (scope[i].metaClass == metaclass) return scope[i]; } return null; }
private boolean expandMetaChoice( Writer output, DbObject object, MetaChoice choice, boolean state[], MetaClass childrenMetaClass, RuleOptions options) throws DbException, IOException, RuleException { boolean expanded = false; Object child = object.get(choice); if (child instanceof DbObject) { DbObject dbChild = (DbObject) child; MetaClass metaClass = dbChild.getMetaClass(); String className = metaClass.getGUIName(); boolean excluded = false; // check if child's class is excluded if (options != null) { excluded = options.isExcluded(className); // if not, check if parent's connection is excluded if (!excluded) { MetaClass metaClass2 = object.getMetaClass(); String parentClassName = metaClass2.getGUIName(); String connectionName = parentClassName + "." + choice.getGUIName(); excluded = options.isExcluded(connectionName); } // end if } // end if if (!excluded) { if (childrenMetaClass.isAssignableFrom(metaClass)) { expanded |= expandChild(output, object, dbChild, 1, state, options); } // end if } // end if } // end if if ((!expanded) && (nullModifier != null)) { expanded |= nullModifier.expand(output, object, options); } // end if return expanded; } // end expandMetaChoice
private MetaClass getChildrenMetaClass() { MetaClass childrenMetaClass = m_childrenMetaClass; if (childrenMetaClass == null) { m_childrenMetaClass = MetaClass.find(sChildrenMetaClass); childrenMetaClass = m_childrenMetaClass; } return childrenMetaClass; }
/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbSemanticalObject.metaClass); metaClass.setIcon("dbsmsumlstereotype.gif"); fStereotypedObjects.setJField(DbSMSStereotype.class.getDeclaredField("m_stereotypedObjects")); fSubStereotypes.setJField(DbSMSStereotype.class.getDeclaredField("m_subStereotypes")); fSuperStereotypes.setJField(DbSMSStereotype.class.getDeclaredField("m_superStereotypes")); fIcon.setJField(DbSMSStereotype.class.getDeclaredField("m_icon")); fIcon.setRendererPluginName("SrImage;StereotypeIcon"); fBuiltIn.setJField(DbSMSStereotype.class.getDeclaredField("m_builtIn")); fBuiltIn.setEditable(false); fMetaClassName.setJField(DbSMSStereotype.class.getDeclaredField("m_metaClassName")); fMetaClassName.setRendererPluginName("SMSSemanticalMetaClass"); fSubStereotypes.setOppositeRel(DbSMSStereotype.fSuperStereotypes); fSuperStereotypes.setOppositeRel(DbSMSStereotype.fSubStereotypes); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
protected boolean verifyExclusion(Serializable obj, RuleOptions options) { boolean excluded = false; if (options == null) { return false; } ArrayList excludeList = options.getExcludeList(); if (obj != null) { if (obj instanceof DbObject) { DbObject dbObj = (DbObject) obj; MetaClass metaClass = dbObj.getMetaClass(); String className = metaClass.getGUIName(); if (excludeList != null) { if (excludeList.contains(className)) { excluded = true; } } } } // end if return excluded; }
public Connector( String ruleName, MetaRelationship aConnector, Rule aChildRule, MetaClass childrenMetaClass, Modifier[] someModifiers) { super(ruleName, someModifiers); m_connector = aConnector; m_childrenMetaClass = childrenMetaClass; // doesn't work childRule = aChildRule; // store m_connector because it is transient sConnector = m_connector.getJName(); // store m_childrenMetaClass because it is transient if (m_childrenMetaClass != null) { sChildrenMetaClass = m_childrenMetaClass.getJClass().getName(); } } // end Connector()
// 'official' constructor // new param: childrenMetaClass public Connector( String ruleName, MetaRelationship aConnector, String childRule, String[] optionalRules, MetaClass childrenMetaClass, Modifier[] someModifiers) { this(ruleName, aConnector, (Rule) null, childrenMetaClass, someModifiers); int nbRules = optionalRules.length; m_childStrRule = childRule; m_oneChildStrRule = optionalRules[0]; m_whenCond = (nbRules > 1) ? optionalRules[1] : null; m_childrenMetaClass = childrenMetaClass; // store m_childrenMetaClass because it is transient if (m_childrenMetaClass != null) { sChildrenMetaClass = m_childrenMetaClass.getJClass().getName(); } } // end Connector()
/** For internal use only. */ public static void initMeta() { try { metaClass.setSuperMetaClass(DbSMSStyle.metaClass); fOr_nameDescriptor.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_nameDescriptor")); fLineColorDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_lineColorDbORCommonItem")); fDescriptorFontDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_descriptorFontDbORCommonItem")); fDashStyleDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_dashStyleDbORCommonItem")); fTextColorDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_textColorDbORCommonItem")); fHighlightDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_highlightDbORCommonItem")); fBackgroundColorDbORCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_backgroundColorDbORCommonItem")); fOr_commonItemLengthDecimalsDisplay.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemLengthDecimalsDisplay")); fOr_commonItemLengthDecimalsFont.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemLengthDecimalsFont")); fReferringProjectCommonItem.setJField( DbORCommonItemStyle.class.getDeclaredField("m_referringProjectCommonItem")); fOr_commonItemNullValueFont.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemNullValueFont")); fOr_commonItemTypeFont.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemTypeFont")); fOr_commonItemTypeDisplay.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemTypeDisplay")); fOr_commonItemNullValueDisplay.setJField( DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemNullValueDisplay")); fReferringProjectCommonItem.setOppositeRel(DbSMSProject.fOrDefaultCommonItemStyle); } catch (Exception e) { throw new RuntimeException("Meta init"); } }
private boolean expandMetaRelation1( Writer output, DbObject object, MetaRelation1 metaRelation1, boolean state[], MetaClass childrenMetaClass, RuleOptions options) throws DbException, IOException, RuleException { boolean expanded = false; Object child; if (childrenMetaClass != null) { if (metaRelation1 == DbObject.fComposite) { child = object.getCompositeOfType(childrenMetaClass); } else { child = object.get(metaRelation1); if (child instanceof DbObject) { DbObject dbChild = (DbObject) child; MetaClass mc = dbChild.getMetaClass(); if (mc != childrenMetaClass) { child = null; } } } } else { child = object.get(metaRelation1); } // end if if (child != null) { if (child instanceof DbObject) { DbObject dbChild = (DbObject) child; MetaClass metaClass = dbChild.getMetaClass(); String className = metaClass.getGUIName(); boolean excluded = false; // check if child's class is excluded if (options != null) { excluded = options.isExcluded(className); // if not, check if parent's connection is excluded if (!excluded) { metaClass = object.getMetaClass(); String parentClassName = metaClass.getGUIName(); String connectionName = parentClassName + "." + metaRelation1.getGUIName(); excluded = options.isExcluded(connectionName); } // end if } // end if if (!excluded) { expanded |= expandChild(output, object, dbChild, 1, state, options); } // end if } // end if } // end if // if a SUF modifier has to be expanded if ((expanded) && (suffixModifier != null)) { suffixModifier.expand(output, object, options); } // if a NULL modifier has to be expanded if ((!expanded) && (nullModifier != null)) { expanded |= nullModifier.expand(output, object, options); } return expanded; } // end expandMetaRelation1
// add childrenMetaClass to filter only children of that class // if null, scan each child protected boolean expandMetaRelationN( Writer output, DbObject object, MetaRelationship metaRelation, boolean state[], MetaClass childrenMetaClass, RuleOptions options) throws DbException, IOException, RuleException { boolean expanded = false; DbEnumeration dbEnumChildren = null; DbRelationN relationN = (DbRelationN) object.get(metaRelation); if (childrenMetaClass == null) { dbEnumChildren = relationN.elements(); } else { dbEnumChildren = relationN.elements(childrenMetaClass); } // a first pass to find out the number of children int nbChildren = 0; try { while (dbEnumChildren.hasMoreElements()) { dbEnumChildren.nextElement(); nbChildren++; // Cancel everything if the user has decided to stop the // operation if (options != null) { Controller controller = options.m_controller; if (controller != null) { boolean can_continue = controller.checkPoint(); if (!can_continue) { throw new RuleException(controller.getAbortedString()); } } } // end if } // end while } finally { dbEnumChildren.close(); } // cannot rollback to the first element, so recreate the enumeration if (childrenMetaClass == null) { dbEnumChildren = relationN.elements(); } else { dbEnumChildren = relationN.elements(childrenMetaClass); } try { while (dbEnumChildren.hasMoreElements()) { DbObject child = (DbObject) dbEnumChildren.nextElement(); MetaClass metaClass = child.getMetaClass(); String className = metaClass.getGUIName(); boolean excluded = false; // check if child's class is excluded if (options != null) { excluded = options.isExcluded(className); // if not, check if parent's connection is excluded if (!excluded) { metaClass = object.getMetaClass(); String parentClassName = metaClass.getGUIName(); String connectionName = parentClassName + "." + metaRelation.getGUIName(); excluded = options.isExcluded(connectionName); } // end if } // end if if (!excluded) { expanded |= expandChild(output, object, child, nbChildren, state, options); } // end if } // end while } finally { dbEnumChildren.close(); } boolean atLeastOneChildPrinted = state[1]; if ((atLeastOneChildPrinted) && (suffixModifier != null)) { expanded |= suffixModifier.expand(output, object, options); } else if ((!atLeastOneChildPrinted) && (nullModifier != null)) { expanded |= nullModifier.expand(output, object, options); } return expanded; } // end expandMetaRelationN