How to use the java api to add WTDocument to the "Change Summary" table in Change Notice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to use the java api to add WTDocument to the "Change Summary" table in Change Notice?
I have code to output "Change Summary" object types from a Change Notice
But I do not know how to add more objects to this table, for example, WTDocument
public static void printChangeAfter(WTChangeOrder2 wtChangeOrder2) {
try {
QueryResult result = ChangeHelper2.service.getChangeActivities(wtChangeOrder2);
while (result.hasMoreElements()) {
WTChangeActivity2 activity = (WTChangeActivity2) result.nextElement();
QueryResult res = ChangeHelper2.service.getChangeablesAfter(activity);
while (res.hasMoreElements()) {
WTObject object = (WTObject) res.nextElement();
System.out.println(object.getType());
}
}
} catch (WTException e) {
System.out.println("error " + e.getMessage());
}
}
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can't add any object to the change summary table. This is just the summary of all the change tasks (change activities). You need to add them to a single change task
Vector partVec = new Vector();
partVec.addElement(part); //assuming you have the WTPart object
partVec = ChangeHelper2.service.storeAssociations(ChangeRecord2.class, task, partVec); //task is Change Activity object
ChangeRecord2 resulting_data = (ChangeRecord2)partVec.firstElement();
resulting_data.setDescription("ChangeRecord2 and a Part");
partVec = ChangeHelper2.service.saveChangeRecord(partVec);
See https://www.ptc.com/en/support/article/CS122930 or https://www.ptc.com/en/support/article/CS200677
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can use instanceof to know if object is WTDocument, WTPart etc
if(object instanceof WTDocument){
WTDocument doc = (WTDocument)Object;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can't add any object to the change summary table. This is just the summary of all the change tasks (change activities). You need to add them to a single change task
Vector partVec = new Vector();
partVec.addElement(part); //assuming you have the WTPart object
partVec = ChangeHelper2.service.storeAssociations(ChangeRecord2.class, task, partVec); //task is Change Activity object
ChangeRecord2 resulting_data = (ChangeRecord2)partVec.firstElement();
resulting_data.setDescription("ChangeRecord2 and a Part");
partVec = ChangeHelper2.service.saveChangeRecord(partVec);
See https://www.ptc.com/en/support/article/CS122930 or https://www.ptc.com/en/support/article/CS200677
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
BjoernRueegg ,please tell me if you have a code to remove objects from the request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You need find the link and delete the link.
Use the Helper class
ChangeHelper2.service.
and than the method you need. If you use the method e.g.
ChangeHelper2.service.getChangeablesAfter(changenotice, false);
then you will receive the links and not the objects. Iterate thru the result and delete the link you don't need anymore.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
