Custom workflow actions #825237/HEAD / v30 |
Tags:
not added yet
Custom workflow actionsDeveloping own/custom
You also need cb.jar from the directory ~/CB-../tomcat/webapps/cb/WEB-INF/lib of the CodeBeamer 7.8.0 or newer installation, you want to develop new custom workflow actions for. ![]() ![]() ![]() For example: ![]() package com.intland.codebeamer.example.actions; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.intland.codebeamer.controller.ArtifactController; import com.intland.codebeamer.manager.workflow.ActionCall; import com.intland.codebeamer.manager.workflow.ActionParam; import com.intland.codebeamer.manager.workflow.WorkflowAction; import com.intland.codebeamer.manager.workflow.ActionParam.Type; import com.intland.codebeamer.manager.workflow.WorkflowPhase; import com.intland.codebeamer.persistence.dto.ArtifactDto; import com.intland.codebeamer.persistence.dto.TrackerDto; import com.intland.codebeamer.persistence.dto.UserDto; @Component("baselineCreator") @WorkflowAction(value="baselineCreator", iconUrl="/images/Snapshot.png", helpUrl="https://codebeamer.com/cb/wiki/816624") public class BaselineCreator { @Autowired private ArtifactController artifactController; @ActionCall(WorkflowPhase.After) public ArtifactDto createBaseline(HttpServletRequest request, UserDto user, TrackerDto tracker, @ActionParam(value="baselineScope", options={"project", "tracker"}, required=true) String scope, @ActionParam(value="baselineName", required=true, width=60) String name, @ActionParam(value="baselineDescription", type=Type.wikitext, width=60, height=2) String description ) throws Exception { ArtifactDto baseline = ... artifactController.createArtifact(request, user, tracker.getProject(), baseline, null); return baseline; } } We recommend, that the package ![]() com.intland.codebeamer.<mycompany>.actions You can use any package name, but when using a sub-package of com.intland.codebeamer, your new actions can be automatically detected and deployed by the Component package com.intland.codebeamer.example.actions; import org.springframework.stereotype.Component; @Component("baselineCreator") public class BaselineCreator { ... }The component id/name (if any) should be the same than the @WorkflowAction id/name (see below). If your custom workflow action is not a Component ![]() ![]() ~/CB-../tomcat/webapps/cb/WEB-INF/classes/my-ApplicationContext.xml Classes providing workflow actions must be annotated as @WorkflowAction. import com.intland.codebeamer.manager.workflow.WorkflowAction; @WorkflowAction(value="baselineCreator", iconUrl="/images/Snapshot.png", helpUrl="https://codebeamer.com/cb/wiki/816624") public class BaselineCreator { ... }There is no special interface ![]() ![]() The @WorkflowAction annotation ![]()
If an action implementation needs access to other CodeBeamer APIs ![]() ![]() import org.springframework.beans.factory.annotation.Autowired; import com.intland.codebeamer.controller.ArtifactController; public class BaselineCreator { @Autowired private ArtifactController artifactController; ... } Each class annotated as @WorkflowAction, must have (at least) one method ![]() import com.intland.codebeamer.manager.workflow.ActionCall; import com.intland.codebeamer.manager.workflow.WorkflowAction; import com.intland.codebeamer.manager.workflow.WorkflowPhase; @WorkflowAction(value="baselineCreator", iconUrl="/images/Snapshot.png", helpUrl="https://codebeamer.com/cb/wiki/816624") public class BaselineCreator { ... @ActionCall(WorkflowPhase.After) public ArtifactDto createBaseline(...) { ... } }Action methods can have any name and return type and should be public. The @ActionCall annotation
Methods annotated as @ActionCall must be Context specific information required by the method, must be declared as parameters ![]() The following context information is available:
You can also declare a parameter with a specific source/context type, e.g. WorkflowTransitionDto. The value of such parameters will be null, if the actual source/context is not an object of this type.
Parameters with simple types (int, double, long and boolean) are implicitly required.
The @ActionParam annotation ![]()
Methods annotated as @ActionCall can throw any type of Exceptions ![]() Two types of exceptions have a special meaning:
Action configuration localizationThe
Via custom language resource files (see ![]() E.g. English texts in ~/CB-../tomcat/webapps/cb/WEB-INF/classes/my-ApplicationResources.properties tracker.action.baselineCreator.label=Create a new baseline tracker.action.baselineCreator.baselineScope.label=Scope tracker.action.baselineCreator.baselineScope.tooltip=The scope of the new baseline tracker.action.baselineCreator.baselineScope.tracker.label=Tracker tracker.action.baselineCreator.baselineScope.tracker.tooltip=Create a new baseline on the current tracker tracker.action.baselineCreator.baselineScope.project.label=Project tracker.action.baselineCreator.baselineScope.project.tooltip=Create a new baseline on the whole project tracker.action.baselineCreator.baselineName.label=Name tracker.action.baselineCreator.baselineName.tooltip=The name of the new baseline tracker.action.baselineCreator.baselineDescription.label=Description tracker.action.baselineCreator.baselineDescription.tooltip=The description of the new baseline E.g. German texts in ~/CB-../tomcat/webapps/cb/WEB-INF/classes/my-ApplicationResources_de.properties tracker.action.baselineCreator.label=Den aktuellen Versionsstand sichern tracker.action.baselineCreator.baselineScope.label=Umfang tracker.action.baselineCreator.baselineScope.tooltip=Der Umfang des neuen Versionsstands tracker.action.baselineCreator.baselineScope.tracker.label=Tracker tracker.action.baselineCreator.baselineScope.tracker.tooltip=Sichere den Versionsstand des aktuellen Trackers tracker.action.baselineCreator.baselineScope.project.label=Projekt tracker.action.baselineCreator.baselineScope.project.tooltip=Sichere den Versionstands des kompletten Projekts tracker.action.baselineCreator.baselineName.label=Name tracker.action.baselineCreator.baselineName.tooltip=Der Name des neuen Versionstands tracker.action.baselineCreator.baselineDescription.label=Beschreibung tracker.action.baselineCreator.baselineDescription.tooltip=Die Beschreibung des neuen Versionstands The resource name for label and tooltip of a workflow action is:
Context specific actionsIf your custom workflow action is only applicable in a specific context, e.g. only for trackers/items of a specific type, then the implementing class should declare an additional predicate/method annotated with @ActionPredicate: import com.intland.codebeamer.manager.workflow.ActionPredicate; import com.intland.codebeamer.persistence.dto.TrackerTypeDto; @WorkflowAction(value="scmChangeFileZipper", iconUrl="/images/cvs_view.gif") public class ScmChangeFileZipper { @ActionPredicate public boolean isApplicable(TrackerTypeDto type) { return TrackerTypeDto.isTrackerType(type); } ... } Methods annotated with @ActionPredicate must be
The method must declare parameters for all required context information, that it needs to make it's decision. The following context information is available:
Deploying workflow actionsTo deploy your custom workflow action, the Java code must be compiled and the resulting *.class file must be uploaded to the appropriate sub-directory under ~/CB-.../tomcat/webapps/cb/WEB-INF/classes/..., where the sub-directory is the equivalent of the action's package name. ~/CB-../tomcat/webapps/cb/WEB-INF/classes/my-ApplicationContext.xml Finally you have to restart CodeBeamer, for your newly deployed actions to get loaded. |
Fast Links
![]() codebeamer Overview codebeamer Knowledge Base Services by Intland Software |
This website stores cookies on your computer. These cookies are used to improve your browsing experience, constantly optimize the functionality and content of our website, and help us understand your interests and provide more personalized services to you, both on this website and through other media. With your permission, we and our partners may use precise geolocation data and identification through device scanning. You may click accept to consent to our and our partners’ processing as described above. Please be aware that some processing of your personal data may not require your consent, but you have a right to object to such processing. By using our website, you acknowledge this notice of our cookie practices. By accepting and continuing to browse this site, you agree to this use. Your preferences will apply to this website only.
Note that user-behavior analytics are being captured on this server to improve the Codebeamer user experience.