cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Windchill Custom Publishing Help

TomU
23-Emerald IV

Windchill Custom Publishing Help

I am trying to create a custom Java filter in order to intercept and modify certain publishing events.  Per this help pagehttp://support.ptc.com/cs/help/windchill_hc/wc110_hc/index.jspx?id=WCCG_BusLogicCust_WCVisualization_CustPublish&action=show, I should be able to intercept all calls made to the publisher, and then do my own thing instead.  Here is the relevant section:


An Advanced Technique for General Publishing

Combining the concepts in Procedure – Invoking Publishing from Custom Code/Workflow with Filtering All Publishing you can open up additional flexibility for general publishing. The technique simply requires you to insert the use of the doPublish method from the Publisher class into the filterMethod shown in the previous subsection. Since the filter method must return a Boolean, simply return Boolean.FALSE and use the doPublish method to cause Publish Jobs to be queued up for execution.

For example you want to provide specific naming information for publishes that were not made from Windchill stored data.

public static Boolean filterMethod(Persistable p, Boolean publishFromDB) {
   if (publishFromDB) return Boolean.TRUE;
   try {
      String objRef = ObjectReference.newObjectReference(p).toString();
      Publisher pub = new Publisher();
      pub.doPublish(false, true, objRef, (ConfigSpec)null,
                    (ConfigSpec)null, true, “Not From Windchill Data”,
                    “”, Publisher.NONE, null, 0);
   } catch (WTException wte) {
      wte.printStackTrace();
   }
   return Boolean.FALSE;
}


The problem I having is I'm unable to determine the parameters that were fed to the job to begin with.  A typical doPublish method call will include the following parameters:

  • viewableLink - If true and the data has already been published, the viewable data will be passed back to allow access by getViewableLink
  • forceRepublish - Overwrites an existing representation should one already exist
  • objectReference - Reference of the Representable to be published
  • configSpec - The EPM Config Spec to be used during the product structure tree walk, if null, as-stored or latest is used.
  • partConfigSpec - The Part Config Spec to be used during the product structure tree walk, if null, latest is used.
  • defaultRep - Should the created representation be the default or not. The first representation in always default.
  • repName - Name of The representation to be created, if null default name will be used
  • repDescription - Description of the representation to be created , if null no description will be used
  • structureType - The type of structure walk to be performed, NONE, EPM, PART, EPM_PLUS_PARTS
  • actionString - Option String, see PublisherAction class, if no options can be null
  • jobSource - Source that submitted the job, 0=unknown, 1=manual, 2=checkin, 3=schedule

In order to make an informed decision on how to process the publishing request, I need to know these things.  For example, submitting a manual publish request will definitely pre-set some of these values:

How do I capture these values?  PTC tech support is telling me the filterMethod is a lightweight class that doesn't have access to the publishing event request parameters.  Does anyone here in the community have a workaround?  Some other way that I can capture these values prior to the doPublish event actually being called?

Thanks!

0 REPLIES 0
Top Tags