Please login or register to access secure site features.

Note: By continuing to use DevConnect Program Services you agree to our latest Registered Member Terms.

Sign in using DevConnect ID

Forgot password?

Trouble logging in?

Submit a ticket for Registration Support.

I have an SSO ID

?
sign in

Don't have a DevConnect or SSO ID ?

Create a DevConnect account or join the program.

register now
^
Forum Index » Avaya Orchestration Designer » OD 8x Servlets best practice   XML
 
Author Message
JanPetersen



Joined: 18/03/2015 03:45:57
Messages: 29
Offline

Hi Dev

My question is what is best practise when using a servlet in OD

*1 : How to create more than one exit point in a servlet

*2 : How to log from a servlet

I have attached a project "Aaod8xSevletTest00" with a servlet node.

Regards

Jan
 Filename Aaod8xSevletTest00.zip [Disk] Download
 Description No description given
 Filesize 501 Kbytes
 Downloaded:  34 time(s)

This message was edited 1 time. Last update was at 29/03/2021 04:31:27

WilsonYu



Joined: 06/11/2013 14:29:24
Messages: 3720
Online

The best practice with the custom servlet should be writing logic for processing values from the project variables and store the results back into the variables in the servletImplementation method only. The following sample demonstrates getting value from a variable named test (which you'd create in the Project Variable editor), increasing the value and storing it back to the variable. It also shows the API to do logging.


public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {

int i = mySession.getVariable(IProjectVariables.TEST).getSimpleVariable().getIntValue();
i++;
mySession.getVariable(IProjectVariables.TEST).getSimpleVariable().setValue(i);

if (mySession.isDDTraceEnabled() == true) {
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "I am logging");
}

}

In terms of branching, you rather use a variable to store the state coming out of the servlet then use a Data node where you can use if/else (to exam the value of the variable coming out of the servlet) for branching
JanPetersen



Joined: 18/03/2015 03:45:57
Messages: 29
Offline

Hi Wilson

Found this in a Servlet node

* The user should override updateBranches() to determine which Goto that the
* framework will activate. If there is not at least one enabled Goto item,
* the framework will throw a runtime exception.<BR>

Would be very useful to have more than one "Branches".

So could you please investigate and provide an example.

Regards

Jan
WilsonYu



Joined: 06/11/2013 14:29:24
Messages: 3720
Online

It depends. You could use this method to manipulate the existing branches. The way to go about it is to first take a look at the code in the getBranches method, which creates the list that is passed to the updateBranches method. You can re-arrange the collection, delete or add new branches using similar code

aGoto = new com.avaya.sce.runtime.Goto("Return", 0, true, "Green");
list.add(aGoto);

aGoto = new com.avaya.sce.runtime.Goto("Return", 0, true, "Yellow");
list.add(aGoto);

aGoto = new com.avaya.sce.runtime.Goto("Return", 0, true, "Red");
list.add(aGoto);
 
 
Go to: