cancel
Showing results for 
Search instead for 
Did you mean: 

Check if an IWDNode has a specific structure

Former Member
0 Kudos

Hi,

I have two components, the Client and the Server.

The Client calls the Server via a method call, passing an IWDNode as a parameter.

This IWDNode must have a series of attributes, that represents the settings by which the Server operates.

Since on the Server I have a design-time built replica of the structure of the IWDNode that has to be passed, is there a way to do a quick check if the IWDNode is the type of the Server's local node and, in case, do a quick cast to the Server's local node's class?

There is no context mapping between the Client and the Server because they need to be decoupled enough in order to allow the Client to call the Server multiple times with possibly different IWDNodes.

Thank you,

Pietro

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If you already have the same replica of the node structure in server component then you don't have to compare the whole structure. If you compare the name only then you can continue with your logic.

Use the following code to get the name.



IWDNode node = // passed node.
String nodeName = node.getNodeInfo().getName();

Hope it helps.

Regards,

Manoj

Former Member
0 Kudos

Hi Manoj,

thank you for your reply. The problem is that the client's node might have the same name but it might be missing an attribute or something like that. I'd prefer not to rely on the client for that.

Thank you,

Pietro

Former Member
0 Kudos

Hi,

In that case just loop through the node and check for each attributes like:



Iterator iter = wdContext.node<NODE NAME>().getNodeInfo().iterateAttributes();
IWDAttributeInfo attrInfo = null;
    while(iter.hasNext()) {
    	attrInfo = (IWDAttributeInfo)iter.next();
    	attrInfo.getName();      // To check with attribute name
                     attrInfo.getDataType().getName();        // To check with attribute type
}

A bit tedious process to check the entire structure, but I don't find any better way.

Regards,

Manoj

Former Member
0 Kudos

Thank you for your kind help.

Pietro

Answers (0)