Representation publishing from code using Publish rules
Hi everyone,
I want to create a "shortcut" for a manual representation creation for an EPM document. The idea is to have preconfigured publish options and assign an action to do the actual call to the publisher.
I have a PublishRules.xml uploaded to the Site --> utilities --> Visualisation Configuration Administration. Because of the rules in this xml I have a dropdown combo (Output Options) on the "Chose Structure Type" step of the New representation wizard. The default value is "All" but if I select for example PDF it will start only one Publish job with the param-set selected.
Now if I want to call from an action the Publisher.doPublish(...) API as I read I have to use the PublisherAction to define the "Output Options".
This is the code that I'm using, but it will trigger the publisher like if I would left "All" in the combo (4 publish jobs will be created):
Publisher pub = new Publisher();
ReferenceFactory ref = new ReferenceFactory();
PublisherAction pa = new PublisherAction("pubrulename","PDF");
pub.doPublish(false,
true,
ref.getReferenceString((Persistable) commandBean.getElementOid().getRefObject()),
(ConfigSpec)null,
(ConfigSpec)null,
true,
"alternate",
null,
Publisher.EPM,
pa.toString(),
1 //job source: manual
);
