cancel
Showing results for 
Search instead for 
Did you mean: 

My custom action can not recognise types of property.

Former Member
0 Kudos

Hi,

My custom action (code below), does not reconise type of it's properties.

It assume each property as an action.Property icon is the same with action icon in the link editor.

When i test execute transaction, it generates error that says it was not an action.

How can i solve this problem?

Thanks.

Custom Action

package com.wipro.action;

import com.sap.xmii.xacute.actions.ActionReflectionBase;

import com.sap.xmii.xacute.core.ILog;

import com.sap.xmii.xacute.core.Transaction;

public class CustomAction extends ActionReflectionBase {

private String strFirstInput;

private String strSecondInput;

private String strOutString;

public CustomAction() {

strFirstInput = "";

strSecondInput = "";

strOutString = "";

}

@Override

public String GetIconPath() {

return "resources/icons/CustomAction.png";

}

@Override

public void Invoke(Transaction trx, ILog ilog) {

try {

strOutString = strFirstInput + strSecondInput;

_success = true;

} catch (Exception e) {

_success = false;

}

}

public String getFirstInput() {

return strFirstInput;

}

public void setFirstInput(String value) {

this.strFirstInput = value;

}

public String getSecondInput() {

return strSecondInput;

}

public void setSecondInput(String value) {

this.strSecondInput = value;

}

public String getOutString() {

return strOutString;

}

//public void setOutString(String value) {

// this.strOutString = value;

//}

@Override

public String[] Inputs(Transaction tx) {

String[] inp = new String[2];

inp[0] = "strFirstInput";

inp[1] = "strSecondInput";

return inp;

}

@Override

public String[] Outputs(Transaction tx) {

String[] out = new String[1];

out[0] = "strOutString";

return out;

}

@Override

public boolean isConfigurable() {

return true;

}

}

catalog.xml

<?xml version="1.0" encoding="UTF-8"?>

<ComponentCatalog>

<Category Name="Cust_Act_" Description="This is the first Action">

<Component Type="Action" Name="CustomAction" Description="" Label="Custom Action" ClassName="com.wipro.action.CustomAction" AssemblyName="CustomAction.jar" HelpFileName="" />

</Category>

</ComponentCatalog>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
@Override
public String[] Inputs(Transaction tx) {
String[] inp = new String[2];
inp[0] = "strFirstInput";
inp[1] = "strSecondInput";
return inp;
}

@Override
public String[] Outputs(Transaction tx) {
String[] out = new String[1];
out[0] = "strOutString";
return out;
}

I have never had to overide these methods in my actions. Maybe your overide has removed the build in functionality to detect inputs and outputs? See what happens if you remove this code.

Also, If it turns out that overiding these methods is something you should be doing, I think MII may want "SecondInput" instead of "strSecondInput". I would guess it used reflection to get the set and get methods ie getSecondInput() vs getstrSecondInput() which doesnt exist.

Former Member
0 Kudos

Hi Christian,

I changed code like below. Now properties icons in link editor are normal.

But, when i execute transaction errors are generated.

errors

[ERROR]: STEP EXCEPTION () : Invalid Assignment Target: [Custom_Action_0.FIrstInput]

[ERROR]: STEP EXCEPTION (Custom_Action_0) : Invalid Assignment Target: [Custom_Action_0.FIrstInput]

[ERROR]: STEP EXCEPTION (Custom_Action_0) : Invalid Assignment Target: [Custom_Action_0.FIrstInput]

[ERROR]: TRANSACTION EXECUTION TERMINATED

In configuration dialog field labels:

FIrstInput --> XFLD_FIRSTINPUT

SecondInput --> XFLD_SECONDINPUT

Is it possible to change fields labels?

How can i solve these problems?

Thanks.

New Codes

package com.wipro.action;

import com.sap.xmii.xacute.actions.ActionReflectionBase;

import com.sap.xmii.xacute.core.ILog;

import com.sap.xmii.xacute.core.Transaction;

/**

*

  • @author cemil.bozlagan

*/

public class CustomAction extends ActionReflectionBase {

private String FIrstInput;

private String SecondInput;

private String Output;

public CustomAction() {

FIrstInput = "";

SecondInput = "";

Output = "";

}

@Override

public String GetIconPath() {

return "resources/icons/CustomAction.png";

}

@Override

public void Invoke(Transaction trx, ILog ilog) {

try {

Output = FIrstInput + SecondInput;

_success = true;

} catch (Exception e) {

_success = false;

}

}

public String getFIrstInput() {

return FIrstInput;

}

public void setFIrstInput(String value) {

this.FIrstInput = value;

}

public String getSecondInput() {

return SecondInput;

}

public void setSecondInput(String value) {

this.SecondInput = value;

}

public String getOutput() {

return Output;

}

@Override

public String[] Inputs(Transaction tx) {

String[] inp = new String[2];

inp[0] = "FIrstInput";

inp[1] = "SecondInput";

return inp;

}

@Override

public String[] Outputs(Transaction tx) {

String[] out = new String[1];

out[0] = "Output";

return out;

}

@Override

public boolean isConfigurable() {

return true;

}

}

Former Member
0 Kudos

Hi Cemil,

try removing the overidden methods as suggested by Christian, it should work fine.

What verision of java you have on custom development machine, I faced problem when I was compiling the code on 1.6 and xMI was on 1.4.2

Rupesh

Former Member
0 Kudos

Custom actions that extend ActionReflectionBase should not override any of the "Reflection" functions. You only need to define public setter/getter methods, Invoke, and optionally, InitAction. If you override any of the other methods you will break the functionality of the ActionReflectionBase base class.

Rick

Answers (0)