When the following instruction is executed, it's reasonable to think that "model.OwnedElement" must have "collaboration" in its collection, in order to assure the integrity.
collaboration.Owner = model;
If it make sense for you too, we have an issue, because we don't have it automatically neither manually by executing the following instruction:
model.OwnedElement.Add(collaboration); //error: Specified Method not supported
We have the same situation in the following:
colaborarion.Context <-> activity.OwnedBehavior //In this case both work, therefore I can assure integrity manually
activity.Edge <-> activityedge.Activity //In this case both work, therefore I can assure integrity manually
activityedge.InPartition <-> objpartition1.ContainedEdge
Thanks in advance,
Fabricio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently nUML doesn't guarantee that associations are kept in sync, so one must manually associate both objects with each other.
Another feature that would be nice to have but we don't (currently) is placing an object in the correct set when it is added to a superset; this way, doing:
someModel.OwnedElement.Add(someElement);
would add someElement to the most specific subset of ownedElement where it could fit. As this is not implemented, you are forced for the time being to know which is said specific set; in the case of collaborations, I guess it could be OwnedType:
someModel.OwnedType.Add(someCollaboration);
After this sentence, you will be able to find the collaboration in the set of owned elements of the model, e.g: "for each element in someModel.OwnedElement " would loop through your collaboration.
I tested this way and it works partially: we can add collaborations to ownedType, but if we try to serialize the resulting model an exception is thrown. I'll try to fix that.
Regards,
Rodolfo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
class Test
{
public static void Main(string[] args)
{
SerializationDriver driver = new SerializationDriver();
driver.AddSerializer(new NUml.Uml2.Serialization.Serializer());
Model m = Create.Model();
Collaboration c = Create.Collaboration();
m.OwnedType.Add(c);
driver.Serialize(m, Console.OpenStandardOutput(), "test");
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Rodolfo,
Suppose we have the following declarations
Model model = NUml.Uml2.Create.Model();
Collaboration collaboration = NUml.Uml2.Create.Collaboration();
When the following instruction is executed, it's reasonable to think that "model.OwnedElement" must have "collaboration" in its collection, in order to assure the integrity.
collaboration.Owner = model;
If it make sense for you too, we have an issue, because we don't have it automatically neither manually by executing the following instruction:
model.OwnedElement.Add(collaboration); //error: Specified Method not supported
We have the same situation in the following:
colaborarion.Context <-> activity.OwnedBehavior //In this case both work, therefore I can assure integrity manually
activity.Edge <-> activityedge.Activity //In this case both work, therefore I can assure integrity manually
activityedge.InPartition <-> objpartition1.ContainedEdge
Thanks in advance,
Fabricio
Hello,
Currently nUML doesn't guarantee that associations are kept in sync, so one must manually associate both objects with each other.
Another feature that would be nice to have but we don't (currently) is placing an object in the correct set when it is added to a superset; this way, doing:
someModel.OwnedElement.Add(someElement);
would add someElement to the most specific subset of ownedElement where it could fit. As this is not implemented, you are forced for the time being to know which is said specific set; in the case of collaborations, I guess it could be OwnedType:
someModel.OwnedType.Add(someCollaboration);
After this sentence, you will be able to find the collaboration in the set of owned elements of the model, e.g: "for each element in someModel.OwnedElement " would loop through your collaboration.
I tested this way and it works partially: we can add collaborations to ownedType, but if we try to serialize the resulting model an exception is thrown. I'll try to fix that.
Regards,
Rodolfo
OK, fixed in SVN, revision 143.
This piece of code now works:
using System;
using NUml.Uml2;
using NUml.Xmi2;
class Test
{
public static void Main(string[] args)
{
SerializationDriver driver = new SerializationDriver();
driver.AddSerializer(new NUml.Uml2.Serialization.Serializer());
Model m = Create.Model();
Collaboration c = Create.Collaboration();
m.OwnedType.Add(c);
driver.Serialize(m, Console.OpenStandardOutput(), "test");
}
}
Thank you so much!
Fabricio