Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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);
Solved! Go to Solution.
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
Resolved
Can you explain how this was resolved and also mark it as answered?
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);