Customizing the Naming Service
Out-of-the-Box
When the user creates a CAD Document using save and upload from Creo actions, an out-of-the-box delegate is designed to provide values for CAD Document Name and Number.
* 
The Naming service is for the upload action only.
The order of precedence used by the system for naming policies and customizations is as follows:
Name:
a. Custom: Naming service customization.
b. PTC_COMMON_NAME: Explicitly assigned Common Name through the Creo Parametric File > New window.
c. Parameter-driven: Name parameter (Operation > Upload Operation > Upload > Naming Parameter = <some string parameter>).
d. Name-driven: File Name (The preference, Operation > Upload Operation > Upload > Drop File Extension From Name takes effect only if Name is assigned based on File Name (CAD Name))
Number:
a. Custom: Naming service customization.
b. Auto-numbering: When the preference, Operation > Upload Operation > Upload Default Value For Number When Unset is set to Do not synchronize file name and number, then the OIRs are used to generate a number.
c. Parameter-driven: Number parameter (Operation > Upload Operation > Upload > Numbering Parameter)
d. Name-driven: The preference, Operation > Upload Operation > Upload > Drop File Extension From Number takes effect only if Number is assigned based on File Name [CAD Name].
* 
The file name can be auto-numbered when OIRs are configured.
For more details about the naming and numbering policies see, Policy-Managed Naming and Numbering
Custom Naming Service with Delegate
The Naming service uses the Windchill service delegate mechanism to allow you to create a java delegate that will be prioritized above any of the out-of-the-box behavior to provide a value for CAD Document Name or Number.
To customize the Naming service:
1. Create a Java Class that implements the interface EPMDocumentNamingDelegate. The interface definition is as follows:
package com.ptc.windchill.uwgm.proesrv.c11n;
public interface EPMDocumentNamingDelegate
{
public void validateDocumentIdentifier(DocIdentifier
docIdentifier);
}
The definition of Class DocIdentifier is as follows.
package com.ptc.windchill.uwgm.proesrv.c11n;
import java.util.HashMap;
public class DocIdentifier
{
{
private String m_modelName;
private String m_docName;
private String m_docNumber;
private HashMap m_parameters;
}
public DocIdentifier(String modelName, String
docName, String docNumber, HashMap params)
{
m_modelName = modelName;
m_docName= docName;
m_docNumber= docNumber;
m_parameters= params;
}
/** get the CAD Name for the model **/

public String getModelName()
{
return m_modelName;
}
/** get the EPMDocument name for the model **/

public String getDocName()
{
return m_docName;
}
/** set the EPMDocument name for the model **/
public void setDocName(String docname)
{
m_docName = docname;
}
/** set the EPMDocument number for the model **/
public void setDocNumber(String docnumber)
{
m_docNumber = docnumber;
}
/** get the EPMDocument number for the model **/
public String getDocNumber()
{
return m_docNumber;
}
/** get the Pro/E designated parameters for the model. These are
name-value pairs indexed by the name **/
public HashMap getParameters()
{
return m_parameters;
}
}
2. In the new class, implement the business logic for naming/numbering EPMDocument in the method:
public void validateDocumentIdentifier(DocIdentifier docIdentifier)
The DocumentIdentifier object has the EPMDocument name and number information for the EPMDocument that will be created by the Upload Service.
Use the DocIdentifier.getModelName() to get the CAD Name of the EPMDocument that this DocIdentifier object represents.
The Creo Parametric designated parameters may be used to set EPMDocument numbering/naming.
Use the DocIdentifier.getParameters() to get the associated parameters.
Use the “set” methods on the DocIdentifier to set the new name/number values. The Upload Service will use these suggestions if they are feasible.
3. Edit site.xconf file (found in <Windchill>) to add following property to indicate availability of customization service on the server:
<Service context="default" name="com.ptc.windchill.uwgm.proesrv.c11n.EPMDocumentNamingDelegate" targetFile="codebase/service.properties">
<Option cardinality="singleton" requestor="wt.epm.EPMDocument" serviceClass="com.ptc.windchill.uwgm.proesrv.c11n.EPMDefaultDocument NamingDelegate"/>
</Service>
Then use the xconfmanager tool to apply the changes to service.properties file (run -xconfmanager p)
Use the path of your class in place of the value of serviceClass (that is, replace "com.ptc.windchill.uwgm.proesrv.c11n.EPMDefaultDocumentNamingDelegate" with the path to your class).
4. Restart the method server.
Was this helpful?