| Products | Versions |
|---|---|
| TIBCO EBX | All versions from 5.8.0. |
The purpose of this guide is to give an example on how to extend a built-in service to add input and output variables that can be used in a workflow or a perspective action.
1) I need to implement a UserServiceExtensionDeclaration and declare my output parameter in the extendWebComponent method.
package com.orchestranetworks.support.module;import com.onwbp.base.text.UserMessage;import com.orchestranetworks.service.ServiceKey;import com.orchestranetworks.userservice.declaration.UserServiceExtensionDeclaration;import com.orchestranetworks.userservice.declaration.UserServicePropertiesDefinitionContext;import com.orchestranetworks.userservice.declaration.WebComponentDeclarationContext;public class AccessDataExtendedDeclaration implements UserServiceExtensionDeclaration{@Overridepublic ServiceKey getServiceKey() {// TODO Auto-generated method stubreturn ServiceKey.forModuleServiceName("supportModule", "accessdataExtended");}@Overridepublic ServiceKey getExtendedServiceKey() {// TODO Auto-generated method stubreturn ServiceKey.DEFAULT_SERVICE;}@Overridepublic void defineProperties(UserServicePropertiesDefinitionContext aContext) {// TODO Auto-generated method stub}@Overridepublic void extendWebComponent(WebComponentDeclarationContext aContext) {// TODO Auto-generated method stubaContext.addOutputParameter("recordID", UserMessage.createInfo("record Id"), UserMessage.createInfo("Selected record"));}} |
2) Then I need to register my user service extension in my ModuleRegistrationListener.
package com.orchestranetworks.support.module;import javax.servlet.annotation.WebListener;import com.orchestranetworks.module.ModuleInitializedContext;import com.orchestranetworks.module.ModuleRegistrationListener;import com.orchestranetworks.module.ModuleServiceRegistrationContext;@WebListenerpublic class RegisterModule extends ModuleRegistrationListener{@Overridepublic void handleContextInitialized(ModuleInitializedContext aContext) {// TODO Auto-generated method stub}@Overridepublic void handleServiceRegistration(ModuleServiceRegistrationContext aContext) {// TODO Auto-generated method stubaContext.registerUserServiceExtension(new AccessDataExtendedDeclaration());}} |
(ModuleRegistrationListener is only available with EBX 5.9 but you can also do it in ModuleRegistrationServlet).
3) I can map output parameters to data context variables when I select the service in my user task definition
