Example #1
0
 function createFeatureTypeTables($stereotype, $parent, $class, $parts = array(), $createUserInfoColumns = false)
 {
     $this->logger->log('<br><b>Create ' . $stereotype . ': ' . $class['name'] . ' </b>');
     # Erzeuge FeatueType
     $featureType = new FeatureType($class['name'], $parent, $this->logger, $this);
     $featureType->setId($class['id']);
     if ($parent == null) {
         $featureType->primaryKey = 'gml_id';
     } else {
         $this->logger->log(' abgeleitet von: <b>' . $parent->alias . '</b>');
     }
     foreach ($this->getAttributes($featureType->id) as $attribute) {
         $featureTypeAttribute = new Attribute($attribute['name'], $attribute['datatype'], $featureType, $parts);
         $new_parts = $parts;
         if (is_array($new_parts)) {
             array_push($new_parts, $featureTypeAttribute);
         }
         $featureTypeAttribute->setStereoType($attribute['stereotype']);
         $featureTypeAttribute->attribute_type = $attribute['attribute_type'];
         $featureTypeAttribute->setMultiplicity($attribute['multiplicity_range_lower'], $attribute['multiplicity_range_upper']);
         $featureTypeAttribute->sequence_number = $attribute['sequence_number'];
         $featureType->addAttribute($featureTypeAttribute);
         $this->attributes[] = $featureTypeAttribute;
     }
     $this->logger->log($featureType->attributesAsTable());
     # lade navigierbare Assoziationsenden von 1:n Assoziationen
     foreach ($this->getAssociationEnds($class) as $end) {
         $associationEnd = new AssociationEnd($end['b_name'], $end['a_class_name'], $end['b_class_name'], $this->logger);
         $associationEnd->stereotype = 'FeatureType';
         $associationEnd->setMultiplicity($end['b_multiplicity_range_lower'], $end['b_multiplicity_range_upper']);
         $featureType->addAssociationEnd($associationEnd);
     }
     $this->logger->log($featureType->associationsAsTable());
     # lade abgeleitete Klassen
     $subClasses = $this->getSubUmlClasses($stereotype, $class);
     # User Info Spalten nur für Leaf Klassen erzeugen.
     if ($createUserInfoColumns and empty($parent)) {
         $featureType->createUserInfoColumns();
     }
     $sql = $featureType->asSql();
     $this->logger->log('<pre>' . $sql . '</pre>');
     # Für alle abgeleiteten Klassen
     foreach ($subClasses as $subClass) {
         $this->logger->log('<br><b>Sub' . $stereotype . ': ' . $subClass['name'] . '</b> (' . $subClass['xmi_id'] . ')');
         $sql .= $this->createFeatureTypeTables($stereotype, $featureType, $subClass, $new_parts, $createUserInfoColumns);
     }
     return $sql;
 }
Example #2
0
 function listFeatureTypesAttributes($stereotype, $parent, $class, $with_first_attrib_name = false)
 {
     $this->logger->log('<br><b>Klasse: ' . $class['name'] . '</b> (' . $class['xmi_id'] . ')');
     # Erzeuge FeatueType
     $featureType = new FeatureType($class['name'], $parent, $this->logger, $this->umlSchema);
     $featureType->setId($class['id']);
     $featureType->primaryKey = 'gml_id';
     if ($parent != null) {
         $this->logger->log(' abgeleitet von: <b>' . $parent->alias . '</b>');
     }
     $featureType->getAttributesUntilLeafs($featureType->alias, $stereotype, array());
     $featureType->flattenAttributes();
     # lade abgeleitete Klassen
     $subClasses = $this->umlSchema->getSubUmlClasses($stereotype, $class);
     if (empty($subClasses)) {
         if ($with_first_attrib_name) {
             $featureType->unifyShortNamesWithFirst(1);
         } else {
             $featureType->unifyShortNames(1);
         }
         $this->renameList = array_merge($this->renameList, $featureType->outputFlattenedAttributes());
         if ($this->logger->level > 0) {
             $featureType->outputFlattendedAttributTable();
         }
     }
     foreach ($subClasses as $subClass) {
         $this->listFeatureTypesAttributes($stereotype, $featureType, $subClass, $with_first_attrib_name);
     }
 }