Customizing the Naming Service (CATIA 3DEXPERIENCE)
The naming service uses the Windchill service delegate mechanism to allow you to specify the following for the new CAD document to be created.
Set a number for the CAD document.
Set a name for the CAD document.
* 
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. Naming service customization.
b. Parameter set for naming (Naming parameter).
c. File name (the Upload Drop Name File Extension preference) is effective only if name is assigned based on file name (CAD name).
Number
a. Naming service customization.
b. Parameter set for numbering (Numbering parameter).
c. File name (the Upload Drop Number File Extension preference) is effective only if name is assigned based on file name (CAD Name).
If the standard Windchill naming and numbering policies do not address your company's needs, you can customize the service to assign a name and number to a CAD document based on this custom logic. Use the following steps 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 CAD documents (EPMDocument) using the following method:
public void validateDocumentIdentifier(DocIdentifier docIdentifier)
The DocumentIdentifier object has the CAD document name and number information for the CAD document that is created by the upload service.
Use the following command to get the CAD Name of the CAD document that this DocIdentifier object represents.
DocIdentifier.getModelName()
The CAD application-designated parameters can be used to set CAD document numbering/naming.
Use the following command to get the associated parameters.
DocIdentifier.getParameters()
Use the set methods on the DocIdentifier to set the new name/number values. The Upload Service uses these suggestions if they are feasible. The sample implementation can be found at the following location:
<Windchill home>/codebase/com/ptc/windchill/uwgm/proesrv/

c11n/EPMDefaultDocumentNamingDelegate.java
3. Edit the 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 the service.properties file:
xconfmanager –p
Use the path of your class in place of the value of serviceClass (that is, replace the following with the path to your class):
com.ptc.windchill.uwgm.proesrv.c11n.EPMDefaultDocumentNami ngDelegate
4. Restart the method server.
¿Fue esto útil?