I performed the steps mentioned by you .My class name is RajivMY jar name is testjava.jarI added variable like this :$IW_HOME/tools/java/bin/javac -classpathRajiv RajivBut still it is stuck..anything wrong in what i did?
You may have to get the .jar file itself in your class path (not just the class name). Also your actual call from your external task should use *java* and not *javac*. If this is becoming an issue, I would switch this out from external task to URL task and you would NOT have to worry about setting any classpaths or anything at all -- will probably simplify things for you.
Do you use callback() method in your java class?Go through the CSSDK docs that will help you lots.
Hi Faizi ,I tried to find the call back in the cssdk docs..but not able to get the success (if you point me to the exact stuff).In one of the post http://devnet.interwoven.com/forums_vb/showthread.php?t=27416&forumid=16&highlight=workflow+stuck , I saw that the transition would happen withtask.chooseTransition(nextTransition,comment);So, In my Java class I have implemented CSTransitionableTask which has the method chooseTransition. The NextTransition and comment are string variables as per the doc. Not sure what is the task object which is calling the choose transition method.This is what I have written... CSTransitionableTask task = null; ((Rajiv) task).chooseTransition(trans,comment);Am I missing anything?
String transition[] = task.getTransitions(); String nextTransition=null; String comment=null; //System.out.println("Length of the transion is :"+transition.length); for (int i=0;i < transition.length;i++) { //System.out.println("Transition at" + i + " is "+ transition); if(transition.equals("Task Name")) { nextTransition=transition; comment="Task Name"; } task.chooseTransition(nextTransition,comment); }
import java.util.Date;import com.interwoven.cssdk.access.CSAuthorizationException;import com.interwoven.cssdk.access.CSExpiredSessionException;import com.interwoven.cssdk.access.CSInvalidUserException;import com.interwoven.cssdk.access.CSOperation;import com.interwoven.cssdk.access.CSUser;import com.interwoven.cssdk.workflow.*;import com.interwoven.cssdk.common.CSException;import com.interwoven.cssdk.common.CSIllegalOpException;import com.interwoven.cssdk.common.CSNameValuePair;import com.interwoven.cssdk.common.CSObjectNotFoundException;import com.interwoven.cssdk.common.CSRemoteException;import com.interwoven.cssdk.filesys.CSArea;import com.interwoven.cssdk.filesys.CSAreaRelativePath;import com.interwoven.cssdk.filesys.CSFile;import com.interwoven.cssdk.filesys.CSInvalidVPathException;import com.interwoven.cssdk.filesys.CSPathStatus;import com.interwoven.cssdk.workflow.*;public abstract class Rajiv implements CSTransitionableTask{ /** * @param args * @throws CSException * @throws CSExpiredSessionException * @throws CSInactiveTaskException * @throws CSObjectNotFoundException * @throws CSRemoteException * @throws CSAuthorizationException */ public String transitionComment = "Completed email notification"; public String transition = ""; public void main(String[] args) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInactiveTaskException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub System.out.println("Rajiv"); String transition[] = task.getTransitions(); String nextTransition=null; String comment=null; //System.out.println("Length of the transion is :"+transition.length); for (int i=0;i < transition.length;i++) { System.out.println("Transition at" + i + " is "+ transition); if(transition.equals("Task Name")) { nextTransition=transition; comment="Task Name"; } task.chooseTransition(nextTransition,comment); } } public CSTask chooseTransition(String arg0, String arg1) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInactiveTaskException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public String[] getTransitions() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public boolean isReadOnly() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public void setAcquireLocks(boolean arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSIllegalOpException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setReadOnly(boolean arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSIllegalOpException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void addComment(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInactiveTaskException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void addFileComment(CSAreaRelativePath arg0, String arg1) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInactiveTaskException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void addNestedWorkflow(int arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public CSPathStatus[] attachFiles(CSAreaRelativePath[] arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInactiveTaskException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public void deleteVariable(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void deleteVariables(String[] arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public CSPathStatus[] detachFiles(CSAreaRelativePath[] arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public Date getAbsoluteTimeout() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public Date getActivationDate() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSArea getArea() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSComment[] getComments() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public String getDescription() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public Date getExpirationDate() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSComment[] getFileComments(CSFile arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSFileNotAttachedException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSAreaRelativePath[] getFiles() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSFile[] getFiles(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public int getId() { // TODO Auto-generated method stub return 0; } public short getKind() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return 0; } public String getKindName() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public String getName() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public String getNeedsAttention() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSUser getOwner() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public int getRelativeTimeout() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return 0; } public int getTimeoutType() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return 0; } public String getVariable(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSNameValuePair[] getVariables(String[] arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public CSWorkflow getWorkflow() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return null; } public int getWorkflowId() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return 0; } public boolean isAcquireLocksSet() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public boolean isActive() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public boolean isPermitted(CSOperation arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public boolean isTryingToLock() throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public boolean isValid() throws CSAuthorizationException, CSRemoteException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub return false; } public void setArea(CSArea arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInvalidVPathException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setDescription(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setName(String arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setOwner(CSUser arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSInvalidUserException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setTimeout(Date arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setTimeout(int arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setVariable(String arg0, String arg1) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public void setVariables(CSNameValuePair[] arg0) throws CSAuthorizationException, CSRemoteException, CSObjectNotFoundException, CSExpiredSessionException, CSException { // TODO Auto-generated method stub } public long getCacheTimeoutMillis() { // TODO Auto-generated method stub return 0; } public void invalidateCache() { // TODO Auto-generated method stub } public void setCacheTimeoutMillis(long arg0) { // TODO Auto-generated method stub }}
You have to code like this: String transition[] = task.getTransitions(); String nextTransition=null; String comment=null; //System.out.println("Length of the transion is :"+transition.length); for (int i=0;i < transition.length;i++) { //System.out.println("Transition at" + i + " is "+ transition); if(transition.equals("Task Name")) { nextTransition=transition; comment="Task Name"; } task.chooseTransition(nextTransition,comment); } Try the above code. Then let me know.
errors from make toolkitcompile:[javac] Compiling 1 source file to /appbin/interwoven/teamsite/local/config/lib/content_center/customer_out/src[javac] /appbin/interwoven/teamsite/local/config/lib/content_center/customer_src/src/Rajiv.java:38: cannot find symbol[javac] symbol : variable task[javac] location: class Rajiv[javac] String transition[] = task.getTransitions();[javac] ^[javac] /appbin/interwoven/teamsite/local/config/lib/content_center/customer_src/src/Rajiv.java:50: cannot find symbol[javac] symbol : variable task[javac] location: class Rajiv[javac] task.chooseTransition(nextTransition,comment);[javac] ^[javac] 2 errorsany help
public void execute(CSClient client, CSExternalTask currentTask, Hashtable params) throws CSException { // 1. Collect the task environment information String defaultTransition = currentTask.getTransitions()[0]; this.transition = defaultTransition; CSWorkflow job = currentTask.getWorkflow(); String targetTaskName = currentTask.getVariable(KEY_TARGET_TASK_NAME); CSTask targetTask = getTaskByName(job, targetTaskName); if (targetTask == null) { this.transitionComment = "target task \"" + targetTaskName + "\" not found. Mail is not sent."; currentTask.chooseTransition(this.transition, this.transitionComment); return; }
Both errors pointing to the fact that you never declare and initiate your variable named *task*. I would suggest to learn some Java basics first. Also probably having this as a URL Task instead of External Task might make it easier for you. My $0.02!
Thanks Viral .task is not variable it should be a object .My problem is that I am not able to get this object .for ex ... if i check one of the OOTB java sample which implements CSURLExternalTask in "MailNotificationTask.java"in that code it is something like this public void execute(CSClient client, CSExternalTask currentTask, Hashtable params) throws CSException { // 1. Collect the task environment information String defaultTransition = currentTask.getTransitions()[0]; this.transition = defaultTransition; CSWorkflow job = currentTask.getWorkflow(); String targetTaskName = currentTask.getVariable(KEY_TARGET_TASK_NAME); CSTask targetTask = getTaskByName(job, targetTaskName); if (targetTask == null) { this.transitionComment = "target task \"" + targetTaskName + "\" not found. Mail is not sent."; currentTask.chooseTransition(this.transition, this.transitionComment); return; } and it is able to get the object for current task as defined in the execute method .but I am not able to find out how will i get this object in my class.
This is exactly why I said that if you are not able to get the *task* then you may want to switch it over to URL Task where the *task* is passed to you automatically. There are quite a few issues that I see with your code. Obviously you do not have CSTask but I am not seeing anything about CSClient either.In your Java class, you'll probably have to get CSClient first. After that look at the array of arguments that is being passed to your main method. I believe if you are using external task then the task ID should be passed as a parameter in there. Based on that task ID, you should be able to get the CSTask object. Again I'd say that if you want to avoid all of this you could simply switch it out with URL Task and all of that is provided to you automatically. Also with URL Task you dont have to worry about including JAR files in your command itself.
Thanks Everyone .......I am able to execute the java class and transition to next step.As vpatel pointed I have used URL Task and able to get the object [] .