Author |
Message
|
vininx |
Posted: Fri Jan 13, 2012 9:36 am Post subject: Accessing Boolean User defined property in Java UDN |
|
|
Acolyte
Joined: 13 Oct 2009 Posts: 69
|
Hi All,
I am having a problem in accessing the boolean user defined property. I am able to access int and String properties whereas, when I access the boolean(checkbox) property, I am getting the below error,
Code: |
BIP2210E: Invalid Configuration Message: attribute name 'detachEnv' not valid for target object 'Sample' |
My code looks like:
Code: |
boolean detachEnv;
public void setDetachEnv (Boolean detachEnv)
{
Boolean dtchBool = new Boolean (detachEnv);
this.detachEnv = dtchBool.booleanValue ();
}
public boolean getDetachEnv ()
{
return this.detachEnv;
}
|
Property defined:-
--------------------
Property.detachEnv=detachEnv
When I remove the boolean user defined proeprty, I am able to deploy the message flow successfully. Please advise. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 13, 2012 10:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
What are the required modifiers to the primitive declaration for a java UDN?
(private, public, static, no modifier,...)?
Are you allowed a primitive field or do you need to have it "boxed"?
Does your class have to be serializable?
Find the answer to these questions and you will probably also have the answer to your problem...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Jan 14, 2012 1:16 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I suspect you'll find it needs to be a Boolean not a boolean.
But I've not bothered to double-check the docs. |
|
Back to top |
|
 |
vininx |
Posted: Mon Jan 16, 2012 1:28 pm Post subject: |
|
|
Acolyte
Joined: 13 Oct 2009 Posts: 69
|
Hi,
I had changed my code as below,
Code: |
private Boolean detachEnv;
public Boolean getDetachEnv ()
{
return this.detachEnv;
}
public void setDetachEnv (Boolean detachEnv)
{
this.detachEnv = detachEnv;
} |
Still I am getting the same error while deployment. |
|
Back to top |
|
 |
Esa |
Posted: Tue Jan 17, 2012 2:34 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
You are trying to do ESQL programming with java.
In java compute nodes UDP's are accessed with .getUserDefinedAttribute(String name) method of MbJavaComputeNode. |
|
Back to top |
|
 |
Esa |
Posted: Tue Jan 17, 2012 4:36 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Esa wrote: |
You are trying to do ESQL programming with java.
In java compute nodes UDP's are accessed with .getUserDefinedAttribute(String name) method of MbJavaComputeNode. |
Sorry, I did not realize that you were talking about an UDN. So you are preparing a support pack of some sort? |
|
Back to top |
|
 |
vininx |
Posted: Tue Jan 17, 2012 9:00 am Post subject: |
|
|
Acolyte
Joined: 13 Oct 2009 Posts: 69
|
Yes... I am creating a support pack... Can you also let me know how to access the enum property, it will be more helpful. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 17, 2012 9:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So when I do double-check the documentation, it tells me that you have to use a String datatype for your attributes.
How to get at an Enum is left as an exercise for the documentation. |
|
Back to top |
|
 |
Esa |
Posted: Tue Jan 17, 2012 9:37 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Never implemented a support pack, but it seems to me you are still using primitive datatypes and datatype wrapper classes in a mixed manner.
The example I found in the infocenter is using primitive datatypes.
I would try this:
Code: |
private boolean detachEnv;
public boolean getDetachEnv ()
{
return this.detachEnv;
}
public void setDetachEnv (boolean detachEnv)
{
this.detachEnv = detachEnv;
}
|
|
|
Back to top |
|
 |
vininx |
Posted: Wed Jan 18, 2012 7:50 am Post subject: |
|
|
Acolyte
Joined: 13 Oct 2009 Posts: 69
|
It works now when I changed like below,
Code: |
private String detachEnv;
public String getDetachEnv ()
{
return this.detachEnv;
}
public void setDetachEnv (String detachEnv)
{
this.detachEnv = detachEnv;
} |
Whatever be the data type, it gets it as "String" only. Thanks for your responses. |
|
Back to top |
|
 |
|