Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Windchill 10.2 M030
I am looking an api to determine if a wtpart or epmdocument is new in the workspace. Anybody have any pointers?
Thanks Randy
Solved! Go to Solution.
Hi Randy,
With the following API you can find the new objects in Workspace:
wt.epm.workspaces.EPMWorkspaceHelper.manager.getNewObjects
Regards,
Bhushan
Hi Randy,
With the following API you can find the new objects in Workspace:
wt.epm.workspaces.EPMWorkspaceHelper.manager.getNewObjects
Regards,
Bhushan
Bhushan Nehe wrote:
Hi Randy,
With the following API you can find the new objects in Workspace:
wt.epm.workspaces.EPMWorkspaceHelper.manager.getNewObjects
Regards,
Bhushan
Thanks!!
That is what I was looking for.
So a code snippet that shows how this is working for me:
WTPart part = (already defined....)
WTCollection wtc = new WTArrayList();
wtc.add(part);
WTSet wts = EPMWorkspaceHelper.manager.getNewObjects(wtc);
if(wts.size() == 1)
{
System.out.println(part.getNumber() + " is a new part.");
}
What I was using was checking for the team id since this is not set in the epmdocument or wtpart database tables for new objects. So I was doing this:
WTPart part = (already defined....)
if(part.getTeamId() == null)
{
System.out.println(part.getNumber() + " is a new part.");
}
My "way" was simpler however probably doomed for failure sometime...
Randy,
API will only work on uploaded objects - to workspace on the server, not the user's local workspace in Creo, etc.
To get an accurate count of what is new and is in whose workspace, you would have to customize some portion of the JavaScript, either through invoking a custom function added to windchill-all.js, javascript that updates a 'Cookie' locally you can read on server side, or in begin_custom.jsp used by the banner customization.
The code would then have to kickoff when that portion of the local workspace is viewed inside Creo or WWGM and retrieve row and columar data in the JavaScript variable storing data pre-render or post-hoc changes, and submit it via Ajax call to the server whereby the server side of the code does whatever is desired with this level of insight into present system activity.
It would be nice if the UI would store in the database what is going on locally, but until the files are uploaded, not neccessarily checked in, you are kind of stuck on a full accuracy of what is considered 'new'.
Good luck,
David