Ejemplo n.º 1
0
        public void CopyFrom(XS_layerType layerType_in)
        {
            int _index = -1;

            this.name_    = layerType_in.name_;
            this.visible_ = layerType_in.visible_;
            this.active_  = layerType_in.active_;
            this.objectcollection_.Clear();
            for (int d = 0; d < layerType_in.objectcollection_.Count; d++)
            {
                this.objectcollection_.Add(
                    out _index,
                    new XS_objectType()
                    );
                this.objectcollection_[_index].CopyFrom(
                    layerType_in.objectcollection_[d]
                    );
            }
        }
Ejemplo n.º 2
0
        public FK[] TableFKs()
        {
            System.Collections.Generic.List <FK> _output
                = new System.Collections.Generic.List <FK>();

            XS_objectType _table_a;
            string        _tableName_a;
            string        _tableFieldName_a;

            XS_objectType _table_b;
            string        _tableName_b;
            string        _tableFieldName_b;

            string _direction;

            XS_objectTypeCollection _objecttypecollection = (XS_objectTypeCollection)this.parent_ref;
            XS_layerType            _layertype            = (XS_layerType)_objecttypecollection.parent_ref;
            XS_layerTypeCollection  _layertypecollection  = (XS_layerTypeCollection)_layertype.parent_ref;
            XS__diagram             _root_ref             = (XS__diagram)_layertypecollection.parent_ref;

            for (int l = 0; l < _root_ref.LayerCollection.Count; l++)
            {
                for (int o = 0; o < _root_ref.LayerCollection[l].ObjectCollection.Count; o++)
                {
                    switch (_root_ref.LayerCollection[l].ObjectCollection[o].Type)
                    {
                    case "UML - Association":
                        if (_root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection.Count != 2)
                        {
                            break;
                        }

                        _table_a          = null;
                        _tableName_a      = "";
                        _tableFieldName_a = "";

                        _table_b          = null;
                        _tableName_b      = "";
                        _tableFieldName_b = "";

                        _direction = "";

                        for (int a = 0; a < _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection.Count; a++)
                        {
                            switch (_root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Name)
                            {
                            case "direction":
                                _direction = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Enum.Val;
                                break;

                            case "role_a":
                                _table_a = _root_ref.Table_search(
                                    _root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[0].To
                                    );
                                _tableName_a      = _table_a.TableName;
                                _tableFieldName_a = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
                                break;

                            case "role_b":
                                _table_b = _root_ref.Table_search(
                                    _root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[1].To
                                    );
                                _tableName_b      = _table_b.TableName;
                                _tableFieldName_b = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
                                break;
                            }
                        }

                        if (
                            (_table_a == this)
                            &&
                            (_direction == "2")
                            )
                        {
                            _output.Add(new FK(
                                            _tableFieldName_a,
                                            _tableName_b,
                                            _tableFieldName_b
                                            ));
                        }
                        if (
                            (_table_b == this)
                            &&
                            (_direction == "1")
                            )
                        {
                            _output.Add(new FK(
                                            _tableFieldName_b,
                                            _tableName_a,
                                            _tableFieldName_a
                                            ));
                        }
                        break;
                    }
                }
            }

            return(_output.ToArray());
        }
Ejemplo n.º 3
0
        public void TableForeignKeys(
            out OGen.Dia.Libraries.Metadata.Diagram.ForeignKey[] foreignKeys_out,
            out System.Collections.Generic.Dictionary <string, OGen.Dia.Libraries.Metadata.Diagram.ForeignKey> foreignKeys_dic_out
            )
        {
            System.Collections.Generic.List <OGen.Dia.Libraries.Metadata.Diagram.ForeignKey> _output
                = new System.Collections.Generic.List <OGen.Dia.Libraries.Metadata.Diagram.ForeignKey>();
            System.Collections.Generic.Dictionary <string, OGen.Dia.Libraries.Metadata.Diagram.ForeignKey> _output2
                = new System.Collections.Generic.Dictionary <string, OGen.Dia.Libraries.Metadata.Diagram.ForeignKey>();

            XS_objectType _table_a;
            string        _tableName_a;
            string        _tableFieldName_a;

            XS_objectType _table_b;
            string        _tableName_b;
            string        _tableFieldName_b;

            string _direction;

            XS_objectTypeCollection _objecttypecollection = (XS_objectTypeCollection)this.parent_ref;
            XS_layerType            _layertype            = (XS_layerType)_objecttypecollection.parent_ref;
            XS_layerTypeCollection  _layertypecollection  = (XS_layerTypeCollection)_layertype.parent_ref;
            XS__diagram             _root_ref             = (XS__diagram)_layertypecollection.parent_ref;

            OGen.Dia.Libraries.Metadata.Diagram.ForeignKey _aux;

            for (int l = 0; l < _root_ref.LayerCollection.Count; l++)
            {
                for (int o = 0; o < _root_ref.LayerCollection[l].ObjectCollection.Count; o++)
                {
                    switch (_root_ref.LayerCollection[l].ObjectCollection[o].Type)
                    {
                    case "UML - Association":
                        if (_root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection.Count != 2)
                        {
                            break;
                        }

                        _table_a          = null;
                        _tableName_a      = "";
                        _tableFieldName_a = "";

                        _table_b          = null;
                        _tableName_b      = "";
                        _tableFieldName_b = "";

                        _direction = "";

                        for (int a = 0; a < _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection.Count; a++)
                        {
                            switch (_root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Name)
                            {
                            case "direction":
                                _direction = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].Enum.Value;
                                break;

                            case "role_a":
                                _table_a = _root_ref.Table_search(
                                    _root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[0].To
                                    );
                                _tableName_a      = _table_a.TableName;
                                _tableFieldName_a = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
                                break;

                            case "role_b":
                                _table_b = _root_ref.Table_search(
                                    _root_ref.LayerCollection[l].ObjectCollection[o].Connections.ConnectionCollection[1].To
                                    );
                                _tableName_b      = _table_b.TableName;
                                _tableFieldName_b = _root_ref.LayerCollection[l].ObjectCollection[o].AttributeCollection[a].String.Replace("#", "");
                                break;
                            }
                        }

                        if (
                            (_table_a == this)
                            &&
                            (_direction == "1")
                            )
                        {
                            _output2.Add(
                                _tableFieldName_a,
                                _aux = new OGen.Dia.Libraries.Metadata.Diagram.ForeignKey(
                                    _tableFieldName_a,
                                    _tableName_b,
                                    _tableFieldName_b
                                    )
                                );
                            _output.Add(_aux);
                        }
                        if (
                            (_table_b == this)
                            &&
                            (_direction == "2")
                            )
                        {
                            _output2.Add(
                                _tableFieldName_b,
                                _aux = new OGen.Dia.Libraries.Metadata.Diagram.ForeignKey(
                                    _tableFieldName_b,
                                    _tableName_a,
                                    _tableFieldName_a
                                    )
                                );
                            _output.Add(_aux);
                        }
                        break;
                    }
                }
            }

            foreignKeys_dic_out = _output2;
            foreignKeys_out     = _output.ToArray();

            //return _output.ToArray();
        }
Ejemplo n.º 4
0
		public void CopyFrom(XS_layerType layerType_in) {
			int _index = -1;

			name_ = layerType_in.name_;
			visible_ = layerType_in.visible_;
			active_ = layerType_in.active_;
			objectcollection_.Clear();
			for (int d = 0; d < layerType_in.objectcollection_.Count; d++) {
				objectcollection_.Add(
					out _index,
					new XS_objectType()
				);
				objectcollection_[_index].CopyFrom(
					layerType_in.objectcollection_[d]
				);
			}
		}