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{ @Override public ServiceKey getServiceKey() { // TODO Auto-generated method stub return ServiceKey.forModuleServiceName( "supportModule" , "accessdataExtended" ); } @Override public ServiceKey getExtendedServiceKey() { // TODO Auto-generated method stub return ServiceKey.DEFAULT_SERVICE; } @Override public void defineProperties(UserServicePropertiesDefinitionContext aContext) { // TODO Auto-generated method stub } @Override public void extendWebComponent(WebComponentDeclarationContext aContext) { // TODO Auto-generated method stub aContext.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; @WebListener public class RegisterModule extends ModuleRegistrationListener { @Override public void handleContextInitialized(ModuleInitializedContext aContext) { // TODO Auto-generated method stub } @Override public void handleServiceRegistration( ModuleServiceRegistrationContext aContext) { // TODO Auto-generated method stub aContext.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