Customization with Windchill Queues
Windchill queues provide a means of scheduling lower priority work which can be run in the background. Many of the OOTB Windchill services create and use queues for lower priority work activities. These capabilities are available to user customizations also.
As part of ongoing efforts to make Windchill more secure and robust access control checks have been added to all public queue APIs. What this means for all future customizations (that use queues) is that all calls to the Queue Service must first either set Administrator, or bypass access control. Failure to do so will result in a not authorized exception being thrown.
Sample Code
The following code pattern should be followed when setting Administrator:
SessionContext previous = SessionContext.newSessionContext();
try {
SessionHelper.manager.setAdministrator();
// make calls to Queue Service
}
finally {
SessionContext.setContext(previous);
}
The following code pattern should be followed when bypassing access control:
boolean previous = SessionServerHelper.manager.setAccessEnforce(false);
try {
// make calls to Queue Service
}
finally {
SessionServerHelper.manager.setAccessEnforce(previous);
}
War dies hilfreich?