Advanced Customization > Business Logic Customization > Customizing Windchill Visualization Services > Custom Publishing > Solution > Procedure – Customizing Check-in Based Publishing > An Advanced Technique for Custom Check-in Based Publishing
  
An Advanced Technique for Custom Check-in Based Publishing
Using the techniques in Filter Publishing for EPMDocument Check-in and Filter Publishing for WTDocument Check-in or Upload do not allow you to provide input for creating Publish Jobs to specify the name of the Representation, description of the Representation, etc. Combining the concepts in Procedure – Invoking Publishing from Custom Code/Workflow with the concepts in Filter Publishing for EPMDocument Check-in and Filter Publishing for WTDocument Check-in or Upload can open up a lot of flexibility for check-in based publishing.
The technique simply requires you to insert the use of the doPublish method from the Publisher class into the epmFilterMethod or the docFilterMethod shown in the previous subsections. Since the two filter methods must return a Boolean, simply return Boolean.FALSE and use the doPublish method to cause Publish Jobs to be queued up for execution.
public static Boolean epmFilterMethod(EPMDocument epmdoc) {

if (epmdoc.getDocType().equals(
EPMDocumentType.toEPMDocumentType("MANIKIN_POSTURE"))) {
return Boolean.FALSE;
}
String objRef = ObjectReference.newObjectReference(epmdoc).toString();
Publisher pub = new Publisher();
pub.doPublish(false, true, objRef, (ConfigSpec)null,
(ConfigSpec)null,
"My Rep", "My Description", Publisher.EPM, null, 0);

return Boolean.FALSE;
}
This is the same example used in Filter Publishing for EPMDocument Check-in , but notice the use of the doPublish method shown in bold. This custom job will now create Representations with the name “My Rep” and a description of “My Description”. Also, note that the returned Boolean from the method is Boolean.FALSE.
Refer back to Procedure – Invoking Publishing from Custom Code/Workflow for see other useful ways to use the doPublish method.