Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: How to quickly delete incoming link?
Topic Summary:
Created On: 16-Sep-2002 18:17
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 16-Sep-2002 18:17
User is offline View Users Profile Print this message


Hong Zhang

Posts: 29
Joined: 12-Sep-2002

Hi there,

Does anyone know how to quickly delelte incoming links? The incoming links might come from different modules.

Thanks a lot for your help!

hong
Report this to a Moderator Report this to a Moderator
 16-Sep-2002 21:43
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

You'll need to give more information, but you need to have the source module ..err.. source object open for edit. In DXL, once you figure out the name of the source module open it edit exclusive, then delete the link handle.

- Louie
Report this to a Moderator Report this to a Moderator
 16-Sep-2002 22:40
User is offline View Users Profile Print this message


Hong Zhang

Posts: 29
Joined: 12-Sep-2002

Hi Louie,

Thanks a lot first for your quick response.

The background for this code is that we just purchased DOORS license and TestDirector license in order to standize our buisness process. Telelogic provide a DXL that can extract test cases that developed in TestDirector into a DOORS formal module called *- Test Plan. However, this DXL code has a big drawback. If we deleted a test case in TestDirector, it is totally gone from TestDirector SQL database. But in the DOORS module, it is still there only change the DCTD Change Status from Add to Deleted. If we have thousands of test case and later on delete part of them frenquently, we will have a very huge formal module in DOORS.

We thought it might be not too difficulty to write a DXL script by ourself to simply delete those deleted test cases. I don't know whether you use this TestDirector thing too or not. I hope that I explain this clearly.

I am new to DXL script. That is why I can't handle this problem well I think.


Here is my code. The first For loop that deletes outlinks works fine. The second For loop definitely not work. But once I run the script, I got the error message saying that "-R-E- DXL: <Line:33> cannot delete Object: object has incoming links". But when I went back to the original module, the incoming link was actually deleted, just leave the object undeleted.


//**********************Code************************
Module m = current
Object o = first m

for o in entire m do {

string s = o."DCTD Change Status"
string ss = "Deleted"

if (cistrcmp(s,ss) == 0) then {

Link outLink, inLink

for outLink in o -> "*" do {
delete (outLink)
}

for inLink in o <- "*" do {
Object targetObj = target inLink

delete (inLink)
}

softDelete o
}
}


thanks a lot again,
hong
Report this to a Moderator Report this to a Moderator
 17-Sep-2002 23:17
User is offline View Users Profile Print this message


r g

Posts: 24
Joined: 20-May-2002

Hong,

I added a line to your code which I believe should help the problem. Hopefully it works...



-------------------------
rg.
Report this to a Moderator Report this to a Moderator
 18-Sep-2002 19:55
User is offline View Users Profile Print this message


Hong Zhang

Posts: 29
Joined: 12-Sep-2002

Hi rq,

Thanks first.

I added the line to the original code. Then I ran the code (for the first time). I got the following error message:
-R-E- DXL: <Line:33> cannot delete Object: object has incoming links
-I- DXL: <Line:42> execution halted
But the incoming link was actully deleted. Then I ran the code for the second time, the object got deleted.

My question here: How can I delete it at one time?

I also did the following:
I set two objects at the same level, both have incoming link from exactly the same object (another object). Then I ran the code. First time, the first object got incoming link deleted and I got the above error message. The second time of running the code, the first object got deleted, the second object got incoming link deleted, and I got the above error message. The third time of running the code, I got the following error:
-R-E- DXL: <Line:33> cannot delete Object: no access to source object
-I- DXL: <Line:42> execution halted

You mentioned in your note "This may cause an error since its dependant on the object assigned in the for loop". What do you mean by this? Also, I have the administrator's right. I should be able to do anything.

Do you have any idea of what's going on here?

thanks again,
hong



Report this to a Moderator Report this to a Moderator
 19-Sep-2002 22:24
User is offline View Users Profile Print this message


r g

Posts: 24
Joined: 20-May-2002

Hong,

I am suspecting that it has to do with the declarations of the variables being inside the loops we are using. (Someone correct me if I'm wrong here) There is an inheritance problem with declaring variables nested inside certain loop and if structures that fail to exist outside of their calls. One basic solution to this is to declare the variable globally before the function call and keep track of each time its written and make sure to clear it out before the next time it loops again to prevent data corruption. On the dark side of things, this means the dynamic ability of DXL is creating a new entry every time a variable is cast (i.e. strings). For the time being, lets try declaring the variables outside of the for structures... and making sure we clean up after each pass through.

As to why it gave an error but actually deleted the link, that I have not given the most attention towards.

-------------------------
rg.
Report this to a Moderator Report this to a Moderator
 19-Sep-2002 22:50
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

1) You cannot delete links within the "for link" loop since the loop requires the existence of the links. Rather create a skip list, add the links to be deleted to it, and after the loop delete all the links in the skip list.

2) Likewise (I believe) you should not delete objects within the "for obj" loop; add them to a skip list and delete them afterwards.

3) You will need to open the source module of the link for incoming links before you will see any of the links.

I didn't compile the following code, but it should work in principle (I couldn't get it to attach, so sorry for the indentation problem):

Skip DelObjSkip = create()
Skip DelLinkSkip
ModName_ ModRef
Object obj
Module mod = ???
Link link

for obj in mod do
{ if (I want to delete this object)
{ DelLinkSkip = create() // Allocate Skip list
// Mark all outlinks for deletion:
for link in obj -> "*" do
{ put (DelLinkSkip, link, link)
}
// open sources of links:
for ModRef in obj <- "*" do
{ ModName = fullName(ModRef)
edit(ModName, false)
}
// Mark all inlinks for deletion
for link in obj <- "*" do
{ put (DelLinkSkip, link, link)
}
// Delete links marked for deletion:
for link in DelLinkSkip do
delete(link)
delete(DelLinkSlip)
flushDeletions()
// Mark object for deletion
put (DelObjSkip, obj, obj)
} // end obj to delete
} // end for all objects
// Delete objects marked for deletion:
for obj in DelObjSkip do
softDelete(obj) // or hardDelete
flushDeletions()
delete DelObjSkip

- Louie
Report this to a Moderator Report this to a Moderator
 20-Sep-2002 19:05
User is offline View Users Profile Print this message


Hong Zhang

Posts: 29
Joined: 12-Sep-2002

Thanks a lot rq and Louie!!!

Let me try the code.

thanks again,
hong
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.