cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to create a WTChangeRequest2 with Affected Objects and Affected End Items using API

Manoj_Dokku4
13-Aquamarine

How to create a WTChangeRequest2 with Affected Objects and Affected End Items using API

I was creating a WTChangeRequest2 with the below code mentioned

 

WTChangeRequest2 ecr = createChangeRequest();

WTSet links = new WTHashSet();
int count1 =0;
createdDocs.stream().forEach(e->{
Changeable2 co = e;
RelevantRequestData2 relevantRequestData;
try {
relevantRequestData = RelevantRequestData2.newRelevantRequestData2(co, ecr);
relevantRequestData.setDescription("some description:"+count1);
links.add(relevantRequestData);
} catch (WTException | WTPropertyVetoException e1) {
e1.printStackTrace();
}
});
ChangeHelper2.service.storeAssociations(ecr, links);

 

 

 

@HelesicPetr 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:STEVEG)

Hi @STEVEG 

I guess that the code works. 

@Manoj_Dokku4 just needed to know what the inputs are co - affected object and ecr - ChangeRequest

 

// example for one affected object
RelevantRequestData2
ecrtochangeable = RelevantRequestData2.newRelevantRequestData2(affectedPart, newCR);
ecrtochangeable = (RelevantRequestData2) PersistenceHelper.manager.store(ecrtochangeable);

PetrH

View solution in original post

4 REPLIES 4

Resolved

Hi @Manoj_Dokku4 

Can you explain how this was resolved and also mark it as answered?

HelesicPetr
22-Sapphire I
(To:STEVEG)

Hi @STEVEG 

I guess that the code works. 

@Manoj_Dokku4 just needed to know what the inputs are co - affected object and ecr - ChangeRequest

 

// example for one affected object
RelevantRequestData2
ecrtochangeable = RelevantRequestData2.newRelevantRequestData2(affectedPart, newCR);
ecrtochangeable = (RelevantRequestData2) PersistenceHelper.manager.store(ecrtochangeable);

PetrH

Hi,  STEVEG

I have used the below code.

 

 

Used streams to loop
where e can be WTPart/WTDocument.

Changeable2 co = (Changeable2)e;
WTSet links = new WTHashSet();
RelevantRequestData2 affectedObjectLink = RelevantRequestData2.newRelevantRequestData2(co, ecr);
links.add(affectedObjectLink);
ChangeHelper2.service.storeAssociations(ecr, links);

 

 

Announcements

Top Tags