cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with custom task in Designer

blezek
Champ on-the-rise
Champ on-the-rise
Hi,

  I worked through the money-tasks example and constructed some custom tasks for the designer, and all went well.

  However, when I create a task containing only a BOOLEAN_CHOICE, it does not get saved in the XML output.  I looked for an error, but didn't see anything.  However, when I add a TEXT property, the boolean shows up.  Just thought I'd let others know.  Example code is below:

Works:
package edu.mayo.mi3c.xb3.designer;

import org.activiti.designer.integration.servicetask.AbstractCustomServiceTask;
import org.activiti.designer.integration.servicetask.PropertyType;
import org.activiti.designer.integration.servicetask.annotation.Help;
import org.activiti.designer.integration.servicetask.annotation.Property;
import org.activiti.designer.integration.servicetask.annotation.Runtime;

@DeweyTask
@SuppressWarnings("unused")
@Runtime(delegationClass = "edu.mayo.mi3c.xb3.task.ClassifySeriesTask")
@Help(displayHelpShort = "Classify a series", displayHelpLong = "Assign tags to the BO associated with this series")
public class ClassifySeriesItem extends AbstractCustomServiceTask {

   @Property(type = PropertyType.TEXT, displayName = "Extra Tags", required = false, defaultValue = "")
   @Help(displayHelpShort = "Tags", displayHelpLong = "Comma-separated list of extra tags to add to the BO")
   private String tags;

   @Property(type = PropertyType.BOOLEAN_CHOICE, displayName = "Wait for completion", required = true, defaultValue = "true")
   @Help(displayHelpShort = "Wait for task completion", displayHelpLong = "If checked, the workflow item does not complete until DEWEY executes the required functionality.  If unchecked, execution immediately continues and the next step in the workflow is assumed to be a 'Receive' task")
   private Boolean synchronous;

   @Override
   public String getSmallIconPath() {
      return "icons/folder_fill_16x16.png";
   }

   @Override
   public String getName() {
      return "Classify Series";
   }

}

Doesn't write out the 'synchronous' tag in the XML:
package edu.mayo.mi3c.xb3.designer;

import org.activiti.designer.integration.servicetask.AbstractCustomServiceTask;
import org.activiti.designer.integration.servicetask.PropertyType;
import org.activiti.designer.integration.servicetask.annotation.Help;
import org.activiti.designer.integration.servicetask.annotation.Property;
import org.activiti.designer.integration.servicetask.annotation.Runtime;

@DeweyTask
@SuppressWarnings("unused")
@Runtime(delegationClass = "edu.mayo.mi3c.xb3.task.ClassifySeriesTask")
@Help(displayHelpShort = "Classify a series", displayHelpLong = "Assign tags to the BO associated with this series")
public class ClassifySeriesItem extends AbstractCustomServiceTask {

   @Property(type = PropertyType.BOOLEAN_CHOICE, displayName = "Wait for completion", required = true, defaultValue = "true")
   @Help(displayHelpShort = "Wait for task completion", displayHelpLong = "If checked, the workflow item does not complete until DEWEY executes the required functionality.  If unchecked, execution immediately continues and the next step in the workflow is assumed to be a 'Receive' task")
   private Boolean synchronous;

   @Override
   public String getSmallIconPath() {
      return "icons/folder_fill_16x16.png";
   }

   @Override
   public String getName() {
      return "Classify Series";
   }

}
20 REPLIES 20

moushmi
Champ in-the-making
Champ in-the-making
Hello blezek,

I am working on customizing the tasks as well.
Is it possible in activiti to  to customize  task to felicitate email attachment?
As per the user guide PropertyType have 8 types(TEXT,TEXT,BOOLEAN_CHOICE,COMBOBOX_CHOICE..and likewise) supported in them.Can i have a 9th type like attachment field which will enable users to attach their documents(if required).

If yes,which is the source code class i should make the changes in?

Please share any other thoughts or workaround if you have any..as your solutions are quite useful..

Thanks and best regards,
Moushmi

blezek
Champ on-the-rise
Champ on-the-rise
I do not know if it is possible to add a file attachment from with the Eclipse Designer.  Perhaps one of the developers can help out.

tiesebarrell
Champ in-the-making
Champ in-the-making
Sure, you could extend Designer to support an additional type and render a file chooser in SWT. I guess the obvious question would be what you want to do file the file itself. You'd probably have a file path in the BPMN, but what does that actually do for you?

moushmi
Champ in-the-making
Champ in-the-making
Sure, you could extend Designer to support an additional type and render a file chooser in SWT. I guess the obvious question would be what you want to do file the file itself. You'd probably have a file path in the BPMN, but what does that actually do for you?


Hello Tiesebarrell,

I am trying to have an attachment option with the email service task which currently it does not support to the end user.
Hence i was trying out various ways in which i can achieve the same.

One of my approach now, is to extend the activiti designer itself to provide a customized task which will include a drawer with sender(text field) ,recepient(text field) and attachment(file field) fields. These data will be passed to the service class(java delegate) which in turn pass the data to mail service task and send a mail with the attachment in it.
Hope this helps you to understand my requirement.
Additionally,i have completed the back end integration which sends a mail with attachment(achieved this my modifying the MailActivityBehavior class in the source code). But now i need to integrate the same with front end by providing an email attachment option in the activiti explorer which will enable the end users to attach their documents.

Providing the source code class names where the changes needs to done will be really appreciated.

I followed the process that was mentioned in user guide but
the moment i am uploading the new jar in the workspace i am getting the following error while opening a bpmn20.xml file in the activiti designer:
java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:4263)
at org.eclipse.swt.SWT.error(SWT.java:4197)
at org.eclipse.swt.SWT.error(SWT.java:4168)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:128)
at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331)
at org.eclipse.swt.graphics.Image.<init>(Image.java:545)
at org.activiti.designer.diagram.ActivitiToolBehaviorProvider.getPalette(ActivitiToolBehaviorProvider.java:532)
at org.eclipse.graphiti.ui.internal.editor.GFPaletteRoot.updatePaletteEntries(GFPaletteRoot.java:104)
at org.eclipse.graphiti.ui.internal.editor.GFPaletteRoot.<init>(GFPaletteRoot.java:80)
at org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior.createPaletteRoot(DefaultPaletteBehavior.java:103)
at org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior.getPaletteRoot(DefaultPaletteBehavior.java:115)
at org.eclipse.graphiti.ui.editor.DiagramEditor.getPaletteRoot(DiagramEditor.java:938)
at org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette.setEditDomain(GraphicalEditorWithFlyoutPalette.java:145)
at org.eclipse.graphiti.ui.editor.DiagramEditor.setConfigurationProvider(DiagramEditor.java:1863)
at org.eclipse.graphiti.ui.editor.DiagramEditor.setInput(DiagramEditor.java:551)
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.setInput(ActivitiDiagramEditor.java:203)
at org.eclipse.graphiti.ui.editor.DiagramEditor.init(DiagramEditor.java:445)
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.init(ActivitiDiagramEditor.java:139)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:828)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2945)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


Also,please let me know in case you have any better approach to resolve this issue.

Best regards,
Moushmi

tiesebarrell
Champ in-the-making
Champ in-the-making
The exception you're getting has to do with the availability of image resources in the extension file, I suspect. I still don't quite get your requirement. Are you trying to send an email with attachment by letting the user upload a document in Activiti Explorer? What exactly do you want to do by extending Designer?

moushmi
Champ in-the-making
Champ in-the-making
The exception you're getting has to do with the availability of image resources in the extension file, I suspect. I still don't quite get your requirement. Are you trying to send an email with attachment by letting the user upload a document in Activiti Explorer? What exactly do you want to do by extending Designer?

HI Tiesebarrell,

I have checked my image to be present in the extended jar in the location:"src/main/resources/diagrams/icon/home.png" at context of the project.

Yes,you are correct,the whole purpose of doing this activity is:
I want to provide an attachment option in the email of the email service task to the end user in Activiti explorer.
Hence i thought may be if i extend the activiti designer and provide a separate drawer which will include all the necessary details like "to,from,attachment" fields to the designer then may be i can achieve my target.

Please let me know in case you have any other better way to achieve this target.

Best regards,
Moushmi

tiesebarrell
Champ in-the-making
Champ in-the-making
AFAIK, there's only basic fields in Activiti Explorer. Those have little to do with what you model in Designer, but are assembled from form properties. So if you want to allow users to upload the attachments for emails in Explorer, you will have to extend Explorer, not Designer.

pascal1
Champ in-the-making
Champ in-the-making
Hi Moushmi,
did you resolve the problem with that exception? I get the same one, everytime when I want to use my customized .jar. I also have the Image in the right path, but the Exception is still there…

Thanks,
Pascal

pascal1
Champ in-the-making
Champ in-the-making
Sorry, my mistake…

You need to overwrite the "getSmallIconPath()"-method everytime. Without an image there will be that exception, it isn´t possible to make a custom-task without an icon packed within the jar.

moushmi
Champ in-the-making
Champ in-the-making
Sorry, my mistake…

You need to overwrite the "getSmallIconPath()"-method everytime. Without an image there will be that exception, it isn´t possible to make a custom-task without an icon packed within the jar.


HI,

I had already overridden the "getSmallIconPath()"-method,along with the image in correct path.Still i am facing the same error.

Thanks and best regards,
Moushmi