cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
739
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: null on 03-09-2005 04:57:58 AM
I get a error each time the call gets to the decision node in the call. The error states the Decision is not a valid decision element class. Using CVP and think I just put the java in the wrong place. I have looked through the CVP and audium guides and it is unclear where to place the .java file.

Subject: RE: Decision element class error
Replied by: Vance Vagell on 06-09-2005 05:25:20 PM
Hi Jeff,

To deploy a custom Decision class copy YOUR_FILE.jar (or YOUR_FILE.class) into the Audium application's deploy/java/application/lib (or class for .class files) directory in Audium Builder for Studio. Then, click on the standard Decision element in the callflow, and specify the class name (without the .class or .jar extension). The JAR or class file will automatically be deployed when the Audium application is deployed.

Note: If you add your custom class to a package, you should either store the package's directory structure in a JAR file, or recreate the directory structure (to match the package) in each place you deploy the .class file(s) to.

Hope this helps,
Vance

Subject: XML Decision issues?
Replied by: null on 07-09-2005 02:44:35 PM
Here is the decision I created. Seemed pretty straight forward, but does not work.

Subject: RE: XML Decision issues?
Replied by: Vance Vagell on 07-09-2005 03:10:24 PM
Hi Jeff,

The decision XML you posted has some syntax problems. In particular:

1) The <string> element should not be a standalone tag, it should encompass two strings to compare (in this case, a variable from element data, and a string constant).

2) The <element> element should not have a "value" attribute (it is not part of the XML decision specification).

Keeping those two changes in mind, here is the correct XML decision:

[code:1:0627b7d8f9]
<knowledge_base>

<rule name="TaxIDDecision" default_exit_state="NotExist">

<exit_state name="Exist" conjugate="or">

<string operator="equal">

<data>

<element name="TaxIDLookup" variable="value"/>

</data>

<constant_string value="EXIST"/>

</string>

</exit_state>

</rule>

</knowledge_base>
[/code:1:0627b7d8f9]

Note that I also removed the second exit state condition from the XML (the condition for NotExist); you declared this as the default exit state, and so there is no need to define the condition for it. If the condition for Exist is not met, then the NotExist exit state will always be followed.

In our earlier conversation, it was mentioned that the element TaxIDLookup is a Database element. I am concerned that accessing the variable named "value" from its element data will not return what you expect. Per the Element Specifications, the Database element sets element data named after the column of the result row (for a single row result). For example, if the row is:

[code:1:0627b7d8f9]
foo bar
123 456
[/code:1:0627b7d8f9]

then the Database element will create a variable named "foo" with value "123" and a variable named "bar" with value "456" in element data at runtime. Unless there is a column named "value" in your database, then this part of the XML decision:

[code:1:0627b7d8f9]
<element name="TaxIDLookup" variable="value"/>
[/code:1:0627b7d8f9]

will return an unexpected result. Please confirm that "value" is indeed the column name you are interested in from the database.

To see the specification for XML decisions, as well as several examples, please refer to Chapter 2 of the User Guide.

Regards,
Vance

Subject: RE: XML Decision issues?
Replied by: Vance Vagell on 07-09-2005 04:51:11 PM
Hi Jeff,

For reference, I have also written this decision using the Audium Java API. While it is listed below, you can also find it attached as a .java file:

[code:1:49f7182896]//These classes are used by standard decision elements.
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.DecisionElementBase;
import com.audium.server.session.DecisionElementData;

/**
* This class is called when a standard decision has been configured to use a
* Java class. Since this is a standard decision element, it applies to a
* specific application and does not have a configuration. As a result, the
* only method needed in this class is the doDecision method.
*/
public class DecideExist extends DecisionElementBase
&#123;
/**
* All decision classes must implement this method. The data is retreived
* through the DecisionElementData class and the result of the decision is
* returned as a String from the method.
*/
public String doDecision&#40;String name, DecisionElementData data&#41; throws AudiumException
&#123;
String exitState = "NotExist"; // default exit state is NotExist

// Check if the "value" variable from TaxIDLookup's element data equals "EXIST"
if &#40;data.getElementData&#40;"TaxIDLookup", "value"&#41;.equals&#40;"EXIST"&#41;&#41; &#123;
exitState = "Exist"; // exit as Exist
&#125;

// Return the appropriate exit state.
return exitState;
&#125;
&#125;[/code:1:49f7182896]

Note that I only had to implement one method to get this to work (about 5 lines of code total, since I based it on a template). You can download templates for all of the custom components in this post, download the file StartWithMe.zip.

Hope this helps,
Vance

Subject: RE: XML Decision issues?
Replied by: Vance Vagell on 07-09-2005 04:58:10 PM
Hi Jeff,

One final note, unrelated to this thread. Since you will be writing a custom Java class to access your database via JNDI, you may wish to take a look at our CellPhoneCompany advanced sample application. It has several custom elements with full source code. Several of the elements access a database using JNDI, and they may be useful starting points for you. You can use the code from that project in any way you wish.

You can download CellPhoneCompany from this post.

Regards,
Vance

Subject: Modifying and using sample projects
Replied by: null on 07-09-2005 08:07:54 PM
I modified the Cellphone company .java file and and am trying to import the modified java into my existing project. What am I missing? Is there a document that steps through the process of importing it into an audium environment? I tried importing it into my lab and just get java errors associated with the audium specific references.

jeff

Subject: RE: Modifying and using sample projects
Replied by: Vance Vagell on 07-09-2005 08:32:10 PM
Hi Jeff,

You should generally not import .java files into an Audium project, since they cannot be compiled from there. A common practice is to start a separate Java project (you can do this within Audium Studio, since it is built on top of the Eclipse platform), and compile the classes from there. So you may have MyProject, an Audium project, and MyProjectCode, a Java project. The projects will be listed in the Navigator pane.

Note that the correct libraries need to be specified in the project settings in order for the custom code to compile. To specify these libraries:

1) Right-click on the Java project name
2) Click on "Properties"
3) Click on "Java Build Path"
4) Click on "Add External JARs"
5) Navigate to AUDIUM_HOME/lib
6) Select framework.jar
7) Click "OK" to add this library
😎 Click "OK" to save the properties

You can now import Java code into this project, edit it, and eventually compile it. Once the class files are generated, you can then copy them to the appropriate locations in your Audium project.

If you have a Java development environment you are more comfortable working in, feel free to use that instead. Many customers use Audium Studio, since it allows them to have their Java code alongside the applications it will be used in, but this is not required. However, if you use another development environment, be sure to configure it to access the framework.jar library as well.

Please refer to the "Compiling Custom Java Components" and "Deployment" subsections of Chapter 2 of the Programmer Guide for information about where the classes should be deployed, as well as information about the external libraries.

Regards,
Vance

Subject: Error with new decision
Replied by: null on 08-09-2005 06:26:50 PM
I get a session error in the logs when this decision is reached. Thanks in advance for the help.

Subject: RE: Error with new decision
Replied by: Vance Vagell on 08-09-2005 06:42:06 PM
Hi Jeff,

You have two closing tags for "data" in this snippet, where you should have one opening, and one closing:

[code:1:47aafde6db]
<data/>

<element name="TaxIDCount" variable="count"/>

<data/>
[/code:1:47aafde6db]

Regards,
Vance

Subject: Decision element class error
Replied by: null on 08-09-2005 07:16:00 PM
I am assuming you mean I need </data> for the opening and <data/> for the closing. When I try this, I get errors in the XML.

Subject: Got it!
Replied by: null on 08-09-2005 07:39:07 PM
As they say..."even a blind squirrel finds a nut sometimes"

Subject: RE: Got it!
Replied by: Vance Vagell on 08-09-2005 07:41:08 PM
Hi Jeff,

I'm glad you got it to work. Let me know if you have any further questions.

Regards,
Vance
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links