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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Publish into a workflow

aemaeth.2501
1-Visitor

Publish into a workflow

Hi,

I would like to publish a WTDocument in a workflow expression.
For the moment I use doPublish(..) method of
com.ptc.wvs.common.ui.Publisher, but no item is added to the Publish
Monitor.

Any help would be greatly appreciated.

Sincerely,

Thibault Magné
2 REPLIES 2

This is the snippet of the code that I used for one of our projects. Make
sure you are capturing the exception and logging them so that the stack
trace will show you the reason for failure.



public static void performPublish(WTObject wto) throws
WTException, PropertyVetoException {

wto = (WTObject)
ContentHelper.service.getContents((ContentHolder) wto);

Vector vector =
ContentHelper.getContentListAll((ContentHolder) wto);

if (vector != null) {

boolean flag1 = true;

for (int iContentCount = 0;
iContentCount < vector.size(); iContentCount++) {

ContentItem
contentitem1 = (ContentItem) vector.elementAt(iContentCount);

if
(contentitem1.getRole() != null &&
!contentitem1.getRole().equals(ContentRoleType.PRIMARY))


continue;

boolean
flag2 = processDocumentContent(wto, contentitem1, flag1);

if (flag2)


flag1 = false;

}

}

}



public static boolean processDocumentContent(WTObject wto,
ContentItem contentitem, boolean flag) {

boolean flag1 = false;

if (wto instanceof WTDocument) {

String as[] =
DocumentHelper.getWorkerForContentItem(contentitem);

if (as[0] != null || 1 < 2)
{

String s =
as[1];


Publish.doPublish(false, true, wto, null, null, flag, s, null, 0,
"<wvsoptions>documentFile=" + s, 2, null);

flag1 =
true;

}

}

return flag1;

}



HTH





Thank you and have a great time.

Best Regards

Swamy Senthil

Principal Solutions Architect, Swasen Inc

swamy.senthil@swasen.com(Email); 909 800 8423(M); 973 324 2729(W); 866
908 6561(F);













From: Thibault Magné [

That works perfectly !

Thanks so much.

Sincerely,

Thibault Magné

Le 20 mars 2012 16:44, Swamy Senthil <senthils@swasen.com> a écrit :

> This is the snippet of the code that I used for one of our projects.
> Make sure you are capturing the exception and logging them so that the
> stack trace will show you the reason for failure.****
>
> ** **
>
> public static void performPublish(WTObject wto) throws
> WTException, PropertyVetoException {****
>
> wto = (WTObject)
> ContentHelper.service.getContents((ContentHolder) wto);****
>
> Vector vector =
> ContentHelper.getContentListAll((ContentHolder) wto);****
>
> if (vector != null) {****
>
> boolean flag1 = true;****
>
> for (int iContentCount =
> 0; iContentCount < vector.size(); iContentCount++) {****
>
>
> ContentItem contentitem1 = (ContentItem) vector.elementAt(iContentCount);*
> ***
>
> if
> (contentitem1.getRole() != null &&
> !contentitem1.getRole().equals(ContentRoleType.PRIMARY))****
>
>
> continue;****
>
> boolean
> flag2 = processDocumentContent(wto, contentitem1, flag1);****
>
> if (flag2)
> ****
>
>
> flag1 = false;****
>
> }****
>
> }****
>
> }****
>
> ** **
>
> public static boolean processDocumentContent(WTObject wto,
> ContentItem contentitem, boolean flag) {****
>
> boolean flag1 = false;****
>
> if (wto instanceof WTDocument) {****
>
> String as[] =
> DocumentHelper.getWorkerForContentItem(contentitem);****
>
> if (as[0] != null || 1 <
> 2) {****
>
> String s =
> as[1];****
>
>
> Publish.doPublish(false, true, wto, null, null, flag, s, null, 0,
> "<wvsoptions>documentFile=" + s, 2, null);****
>
> flag1 =
> true;****
>
> }****
>
> } ****
>
> return flag1;****
>
> }****
>
> ** **
>
> HTH****
>
> ** **
>
> ** **
>
> Thank you and have a great time.**
>
> Best Regards**
>
> * Swamy Senthil***
>
> * Principal Solutions Architect, **Swasen Inc*****
>
> swamy.senthil@swasen.com(Email); 909 800 8423(M); 973 324 2729(W); 866
> 908 6561(F); ****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> *From:* Thibault Magné [
Announcements


Top Tags