Adding Business Logic

After configuring the plug-in palette and activity, you can add business logic for the SayHello activity.

Prerequisites

Ensure that you have generated a HelloWorld palette and a SayHello activity, as described in Defining a HelloWorld Palette.

Procedure

  1. In TIBCO Business Studio, from the menu, click Run > Run Configurations to launch a child TIBCO Business Studio:
    1. In the "Create, manage, and run configurations" dialog, double-click Eclipse Application in the left panel, and then click New_configuration.
    2. Click Debug to launch a child TIBCO Business Studio configured with the bw-runtime platform.
  2. In the child TIBCO Business Studio, click File > Import to import the features and bundles of runtime and model to the child TIBCO Business Studio:
    1. In the Select dialog, expand the General folder and select Existing Projects into Workspace. Click Next.
    2. In the Import Projects dialog, click Browse to locate the project folder that contains the HelloWorld plug-in project.
    3. Click Deselect All, and then select the runtime and model bundles, and features. Click Finish.
    The bundles and features of runtime and model are loaded in the child TIBCO Business Studio.

  3. In the Project Explorer view, expand the com.tibco.bw.palette.helloworld.runtime folder, and then click src > com.tibco.bw.palette.helloworld.runtime > SayHelloAsynchronousActivity.java.
  4. In the SayHelloAsychronousActivity.java file, find the evalOutput() method.
  5. In the evalOutput() method, enter Hello World as the output text.
    This method is used to generate the output structure for an activity by passing the string value to the output structure.
    protected <A> N evalOutput(N inputData, ProcessingContext<N> processingContext, Object data) throws Exception {
    
    	SayHelloOutput sayHelloOutput = new SayHelloOutput();
    	sayHelloOutput.setOutput("String Value");
    	// begin-custom-code
    	// add your own business code here
    sayHelloOutput.setOutput("Hello World");
    	// end-custom-code
    N outputNode = PaletteUtil.parseObjtoN(SayHelloOutput.class, sayHelloOutput, processingContext, activityContext.getActivityOutputType().getTargetNamespace(), "SayHelloOutput");
    	return outputNode;
    }
  6. Save the SayHelloAsychronousActivity.java file.