Creating the Windchill Server-side Customization
The Windchill server provides the infrastructure to validate custom Windchill Workgroup Manager requests, and invoke a custom service. Typically, you need to perform the following steps:
1. Implement the UwgmC11nService interface.
2. Register the custom service in <Windchill>/codebase/com/ptc/windchill/uwgm/common/delegate/application.service.xconf.
The different types of custom requests invoke different methods:
The non–workspace based custom request (C11nRequest) invokes the UwgmC11nService.execute() method.
The workspace-based custom request (WorkspaceC11nRequest) invokes the UwgmC11nService.executeInWS() method.
However, both of these methods use a customized request context (C11nRequestContext) which provides the getters for the following attributes:
WTPrincipal
Locale
Client Name
Version
SessionID
Both these methods ((execute() and executeInWS()) return an intermediate UwgmC11nResponse which is then serialized back to the client as C11nMessage.
UwgmC11nService
public interface UwgmC11nService
{
/**
* The Cutsom service delegate is expected to implement execute
* @param c11nCtx
: com.ptc.windchill.uwgm.proesrv.c11n.C11nRequestContext
* @param c11nInstructions
: Map<String, String>
* @param c11nIterationInstructions
: Map<Persistable, Map <String, String>>
* @return UwgmC11nResponse
: com.ptc.windchill.uwgm.proesrv.c11n.UwgmC11nResponse
* @throws WTException
: Exception
* @throws ConflictException
: Conflict
*/
public UwgmC11nResponse execute(C11nRequestContext c11nCtx,
Map<String, String> c11nInstructions,
Map<Persistable, Map<String, String>>
c11nIterationInstructions)
throws WTException, ConflictException;

/**
* The Cutsom service delegate is expected to implement execute
* @param c11nCtx
: com.ptc.windchill.uwgm.proesrv.c11n.C11nRequestContext
* @param c11nInstructions
: Map<String, String>
* @param c11nIterationInstructions
: Map<Persistable, Map <String, String>>
* @param ws
: EPMWorksapce
* @return UwgmC11nResponse
: com.ptc.windchill.uwgm.proesrv.c11n.UwgmC11nResponse
* @throws WTException
: Exception
* @throws ConflictException
: Conflict
*/
public UwgmC11nResponse executeInWS(C11nRequestContext c11nCtx,
EPMWorkspace ws,
Map<String, String> c11nInstructions,
Map<Persistable, Map<String, String>>
c11nIterationInstructions) throws WTException,
ConflictException;
}
C11nRequestContext
public interface C11nRequestContext
{
/**
* returns current user (principal)
* @return WTPrincipal
*/
public WTPrincipal getPrincipal();

/**
* returns current client's locale
* @return Locale
*/
public Locale getLocale();

/**
* returns client canonic name
* @return String
*/
public String getClientName();

/**
* returns client canonic version
* @return int
*/
public String getClientVersion();

/**
* returns the session information of the Client
* @return String
*/
public String getClientSessionID();

/**
* retruns the name of the PDM request
* @return String
*/
public String getRequestName ();
}
UwgmC11nResponse
public UwgmC11nResponse(Map<String, String> stringData,
Map<Persistable, Map<String, String>> iterationData)
{
responseData = stringData;
iterationResponseData = iterationData;
}

/**
* It is expected that the client recieving the response
* understands the semantics
* of the keys; and accordingly interprets the
* value of the response.
* @return Map <String, String>
*/
public Map<String, String> getResponseData()
{
return responseData;
}

/**
* Response elements associated to the Persistable.
* It is expected that the client recieving the response s
* understand the semantics of the key; and accordingly
* interprets the value of the entries in the String Map
* associated with each Persistable in the Map.
*
* @return Map<Persistable, Map<String, String>>
*/
public Map<Persistable, Map<String, String>> getIterationResponseData()
{
return iterationResponseData;
}

/**
* logging
*/
private static Log log = LogFactory.getLog(UwgmC11nResponse.class);
}
An example implementation of UwgmC11nService is provided in your Windchill installation at <Windchill>/codebase/com/ptc/windchill/uwgm/proesrv/c11n/UwgmC11nServiceTest.java for reference only. You are not expected to reuse this class. You need to implement your own server-side customization as per your needs.
Isto foi útil?