Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Martin Terreni on August 19, 2007, 03:40:01 am

Title: Default version per packge
Post by: Martin Terreni on August 19, 2007, 03:40:01 am
Here is my problem:
I need to have a default version for object which should be per branch, e.g. for a package from version1.1 I may have two sub-packages one that is not going to be changed (so it remains 1.1) and one which is going to be changed in version currently in design (1.2) then every new object under this package should have by default version 1.2.
There might be even a third sub package which is in design, but the changes will be released only in 1.5, so the package should have version 1.5 and by default any newly crated objects.
The above said, all the old objects (even under packages in design) should have version 1.1 if they are not changed.

I tried creating a trigger for insert in DB on t_objects and t_package, but it just doesn't work. mainly because both need to have the same GUID, So I can't create them my self.
This is a very inconsistent DB - since the data from t_package (like name,version and so) is duplicated in t_object. It is certainly not 3NF normalized.

I will probably have to do it through automation interface (which is a pane in the ass), but I don't know other options.

Does someone else think it should be a feature in EA?
Title: Re: Default version per packge
Post by: Martin Terreni on August 19, 2007, 04:17:28 am
How can it be that this works:
Code: [Select]
ALTER TRIGGER dbo.SetDefaultVersion

  ON  dbo.t_package

  INSTEAD OF INSERT

AS

BEGIN

       -- SET NOCOUNT ON added to prevent extra result sets from

       -- interfering with SELECT statements.

       SET NOCOUNT ON;

   -- Insert statements for trigger here

INSERT INTO  dbo.t_package

SELECT  Name+'2', Parent_ID, CreatedDate, ModifiedDate, Notes, ea_GUID, XMLPath, IsControlled, LastLoadDate, LastSaveDate, Version, Protected, PkgOwner, UMLVersion, UseDTD, LogXML, CodePath, Namespace, TPos, PackageFlags, BatchSave, BatchLoad

FROM inserted

END

GO


But this has no effect:
Code: [Select]
ALTER PROCEDURE UPDATE_VERSION_FOR_OBJECT(@inserted int)

AS

BEGIN

       -- SET NOCOUNT ON added to prevent extra result sets from

       -- interfering with SELECT statements.

       SET NOCOUNT ON;

UPDATE dbo.t_object

SET Version = 1.5

WHERE dbo.t_object.Object_Id = @inserted

END

GO


???