Book a Demo

Author Topic: Convert a CLASS element to a TABLE element? EA14  (Read 7596 times)

MICHEL ADRIANO AGOSTINI

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Convert a CLASS element to a TABLE element? EA14
« on: September 12, 2018, 12:33:50 am »
In EA14, how can I convert a CLASS element to a TABLE element?
I incorrectly created several CLASS-like elements with TABLE stereotype.
I need to convert to be able to have TABLES elements, and with that do the foreign keys correctly.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #1 on: September 12, 2018, 12:56:46 am »
Out of memory I'd just try to apply the stereotype <<table>>. There should be in the appropriate MDG section.

q.

MICHEL ADRIANO AGOSTINI

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #2 on: September 12, 2018, 01:21:34 am »
I'll try to clarify my doubt:

I have 50 elements already related to several others.
They are CLASS type and TABLE stereotype.
I need to convert them to TABLE type and TABLE stereotype.
To be able to work with the FOREIGN KEY CONSTRAINT functionality.

Because in EA14 I can only have FOREIGN KEY with elements of type TABLE, in EA13 that limitation did not exist, and I made the association between types CLASS and TABLES or CLASS and CLASS, always being of the stereotypes TABLE.

TKS.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #3 on: September 12, 2018, 01:29:13 am »
In the stereotype dropdown you find EAUML and there a table stereotype. When I assigned that to a class it appeared as a table. I also verified that the meta type has been changed correctly.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #4 on: September 12, 2018, 01:35:16 am »
This is the code I use to create Tables in C#

Code: [Select]
protected override void saveMe()
        {
            if (_wrappedClass == null)
            {
                var databasePackage = this._owner._wrappedPackage;

                if (databasePackage != null)
                {
                    Package tablePackage = databasePackage.ownedElements.OfType<Package>()
                        .FirstOrDefault(x => x.name.Equals("Tables", StringComparison.InvariantCultureIgnoreCase));
                    Package ownerPackage = databasePackage;
                    if (tablePackage != null) ownerPackage = tablePackage;
                    _wrappedClass = this._factory._modelFactory.createNewElement<Class>(ownerPackage, this.name);
                    //TODO: provide wrapper function for gentype?
                    _wrappedClass.wrappedElement.Gentype = this.factory.databaseName;
                    _wrappedClass.setStereotype("EAUML::table");
                    _wrappedClass.save();
                    //set override and rename and tableSpace
                    this.isOverridden = this.isOverridden;
                    this.isRenamed = this.isRenamed;
                    this.tableSpace = this.tableSpace;
                    this.tableOwner = this.tableOwner;
                    //add trace relation to logical class(ses)
                    setTracesToLogicalClasses();
                }
                else
                {
                    throw new Exception(string.Format("cannot save {0} because wrapped package for database {1} does not exist", this.name, this.databaseOwner.name));
                }
            }
            else
            {
                //save the class to save the changes to the existing table
                _wrappedClass.save();
            }

        }

Geert

MICHEL ADRIANO AGOSTINI

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #5 on: September 12, 2018, 01:56:31 am »
In the stereotype dropdown you find EAUML and there a table stereotype. When I assigned that to a class it appeared as a table. I also verified that the meta type has been changed correctly.

q.

Thank you very much, I applied the stereotype UML :: table according to your orientation and the elements were with the TYPE being TABLE.


How to close this topic? Or mark as Resolved?

Tks again.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Convert a CLASS element to a TABLE element? EA14
« Reply #6 on: September 12, 2018, 04:23:32 am »
You don't, though there's a button somewhere. But almost nobody is using it here.

q.