Author Topic: Ghost Tagged Value Issue  (Read 3087 times)

Hermes

  • EA User
  • **
  • Posts: 41
  • Karma: +0/-0
    • View Profile
Ghost Tagged Value Issue
« on: January 23, 2010, 04:43:39 am »
Dear sparx Community

I've experienced a strange problem.

When I add   new connector, with its own set of tagged values all seems to works fine... but actually after the end of the execution no tags were added.


I've tryed to get all taggedvalues just before the end of the AddConnector flow... and it seems to fetch all the tags needed... but it is not true.

If may helps I can post my code... (I'm going out of my head)  :'(

Code: [Select]
public static bool SyncLink(EA.Connector conn, EA.Repository rep)
        {
            bool rval = true;
            rval &= SyncElementAttributes(conn.TaggedValues, AppConfig.EAP_LINK_STEREOTYPE);
            rval &= SyncElementAttributes(conn.TaggedValues, conn.Stereotype);

            rval &= conn.Update();              

            return rval;
        }

public static bool SyncElementAttributes(EA.Collection coll, string stereotype)
        {
            XmlTextReader reader = getXMI_StereorypeTaggedValues(stereotype);

            if (reader == null)
            {
                AppConfig.last_error_msg = "XMI Profile Error.";
                return false;

            }

            bool rval = true;
            
            while (seekNextTaggedVal(reader))
                rval &= AddConnectorTagStereotyped(coll, reader.GetAttribute("name"), stereotype, reader.GetAttribute("values"), reader.GetAttribute("default"), reader.GetAttribute("description"));

            coll.Refresh();

            return rval;
        }

public static bool AddConnectorTagStereotyped(EA.Collection coll, string name, string stereotype, string values, string def, string descr )
        {

            EA.ConnectorTag tag = GetConnectorTaggedValue(coll, name);
            if (tag == null)
            {
                tag = coll.AddNew(name, AppConfig.EAP_TAGGEDVALUE_TYPE) as EA.ConnectorTag;
            }

            /* Handling Tag Notes */
            string notes = "";

            if (values != string.Empty)
                notes += "Values: " + values + "\r\n";

            if (def != string.Empty)
                notes += "Default: " + def + "\r\n";            

            if (descr != string.Empty)
                notes += "Description: " + descr + "\r\n";            

            tag.Notes = notes;
            /* Handling Tag Notes END */

            tag.Value = def;

            if (!tag.Update())
            {
                AppConfig.last_error_msg = "Cant add Attribute [" + name + "],[" + AppConfig.EAP_TAGGEDVALUE_TYPE + "]";
                return false;
            }

            return true;
        }

what is wrong?

Note that this anomaly is located on a previously debugged (and found working code).


Please helpme.

/H
« Last Edit: January 23, 2010, 04:44:31 am by hermes »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Ghost Tagged Value Issue
« Reply #1 on: January 23, 2010, 05:18:38 am »
If I read it correctly (damn forum code view) you are not updating the tagged value itself, but only the connector.

Geert

Hermes

  • EA User
  • **
  • Posts: 41
  • Karma: +0/-0
    • View Profile
Re: Ghost Tagged Value Issue
« Reply #2 on: January 23, 2010, 08:27:21 pm »
Thank you Geert, but actually I yet do the tag update... on the least reported lines of code. :(

Any other ideas?  :)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Ghost Tagged Value Issue
« Reply #3 on: January 25, 2010, 05:53:42 pm »
Maybe,

Try updating the (new) connector before adding the tags.
If you haven't updated the connector is doesn't exist yet in the database.
Hence it is pretty problematic to add tagged values to the database since they need an FK to the connector (which doesn't exist yet).

I think that may solve the issue.
If I'm correct you shouldn't have this problem with already existing connectors, only with new connectors.

Geert

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Ghost Tagged Value Issue
« Reply #4 on: March 13, 2010, 03:56:58 am »
Hello

Have you found a solution for the problem. I think a try the same thing than you. Which value does these EAP_... Literal has.

Regards Michael