Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: Include new participants after the workflow has started.

$
0
0

Hi Guys,

 

I'm doing some tests for this functionality, but I could not move. For I can not call the method activity.getParentProcess().

 

Any idea how I can fix?

 

Thanks!

 

public class TestAddUser {

 

          public static void main(String[] args) throws RemoteException, InvocationTargetException {

 

                    ObjectIdentifier obid;

                    ObjectIdentifier obidSelf;

                    ObjectReference self;

                    WTUser user = null;

                    Team team = null;

                    WfProcess process = null;

                    try {

                              obid = ObjectIdentifier.newObjectIdentifier("wt.workflow.work.WfAssignedActivity:510292536");

                              WfAssignedActivity activity = (WfAssignedActivity) PersistenceHelper.manager.refresh(obid);

                              user = OrganizationServicesHelper.manager.getAuthenticatedUser("doc");

 

                              obidSelf = ObjectIdentifier.newObjectIdentifier("wt.workflow.engine.WfProcess:510289896");

                              System.out.println("obidSelf: "+obidSelf);

                              self = (ObjectReference.newObjectReference(PersistenceHelper.manager.refresh(obidSelf)));

 

                              process = ((WfProcess) self.getObject());

 

                              team= (Team) process.getTeamId().getObject();

 

                              System.out.println("Team = "+team);

                              System.out.println("User = "+user);

                              System.out.println("Activity = "+activity.getName());

 

                              TeamHelper.service.addRolePrincipalMap(Role.toRole("CLIENTE"), user, team);

                WorkflowHelper.service.doDynamicUpdate(activity.getParentProcess());

                    } catch (Exception e) {

                              e.printStackTrace();

                    }

          }

 

 

}

 

 

WARNING: The ManagerService is not initialized!  This can be caused by:

1) Attempting to invoke a server only method from a remote client

2) Attempting to invoke a method on a service from the constructor or static initializer of another service

Exception in thread "main" java.lang.ExceptionInInitializerError

          at wt.workflow.engine.WfActivity.getParentProcess(WfActivity.java:778)

          at com.anderson.testes.TesteAddUser.main(TesteAddUser.java:50)

Caused by: java.lang.NullPointerException

          at wt.session.SessionServerHelper.<clinit>(SessionServerHelper.java:40)

          ... 2 more


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>