Topic
3 replies Latest Post - ‏2013-03-06T12:54:37Z by SystemAdmin
SystemAdmin
SystemAdmin
1192 Posts
ACCEPTED ANSWER

Pinned topic Simple business logic method call (Perform Invoke a Java Method)

‏2013-02-26T09:53:44Z |
I am trying to execute a really simple (test) method I created in my Business logic class, the steps I took are:
1. Project -> new Business Logic (with global variable helper methods ticked)
2. Inside the file I created a really simple method called insertUnit




public 

static 

void insertUnit(IBusinessLogicInformation blInfo) 
{ HostScreen hs = blInfo.getHostScreen(); 

int row = 5; 

int col = 13; String uUnit = 
"My unit"; hs.SetText(uUnit, row, col); hs.SendKeys(
"[enter]"); 
}


3. in the macro itself I added a "Perform" action and specified "insertUnit" as Java method

<actions> <perform value=
"$insertUnit$" /> </actions>


When I test the macro the method is not executed and the trace (Macro navigator on the left hand side) hangs on the action step specified above.
The result of the method I am expecting is a change in my current operating unit to "My unit", which does not happen.

How can I make this task to run?
Updated on 2013-03-06T12:54:37Z at 2013-03-06T12:54:37Z by SystemAdmin
  • tmparker
    tmparker
    514 Posts
    ACCEPTED ANSWER

    Re: Simple business logic method call (Perform Invoke a Java Method)

    ‏2013-02-26T16:55:15Z  in response to SystemAdmin
    You can't execute business logic from a macro. Business logic can only be executed as a HATS action in a screen event since requires the IBusinessLogicInformation object to be passed to it. In your case it makes no sense to call business logic since the code you are running can be easily done in the macro itself. Why are you trying to use a Java class here?

    Thanks
    Tim
    • SystemAdmin
      SystemAdmin
      1192 Posts
      ACCEPTED ANSWER

      Re: Simple business logic method call (Perform Invoke a Java Method)

      ‏2013-02-27T07:56:38Z  in response to tmparker
      So then I'd need to make a screen customization and execute the code from there? I think I might missed the concept about that one. What kinds of methods are then available to execute in the 'Perform Invoke a Java method'?
      I was merely trying out business logic and general java, thus the code for this logic is trivial.

      Thanks for help Tim!