WebSphere Integration Developer: Visual Snippet Java Code Generation Is Non-Deterministic

I present the following exhibit:

The only difference between these two snippets is the string that I am setting in the commonName attribute.

But, let’s look at the java that was generated under the covers for the bottom snippet:

boolean __result__31 = (iFlag != null) && (iFlag.trim().equals("Y"));
 if (__result__31){
commonj.sdo.DataObject svcCharVal = __result__34;
java.lang.String __result__36 = "HIGH SPEED INTERNET";
svcCharVal.set("commonName", __result__36);
java.util.List __result__38 = svcChar.getDataObject(..).getList("...");
boolean __result__40;
{// add item to list
__result__40 = __result__38.add(svcCharVal);
}
}

Looks good. But check out what I have generated for the first snippet:

boolean __result__19 = (tvFlag != null) && (tvFlag.trim().equals("Y"));
 if (__result__19){
commonj.sdo.DataObject svcCharVal = __result__22;
java.lang.String __result__25 = "TV";
java.util.List __result__26 = svcChar.getDataObject(...).getList(...);
boolean __result__28;
{// add item to list
__result__28 = __result__26.add(svcCharVal);
}
}

If you look closely, you’ll notice that the

svcCharVal.set("commonName", __result__25);"

IS MISSING IN THE FIRST SNIPPET

This means that the snippet I see visually and the actual java generated for the snippet aren’t the same. It appears that not only is the visual snippet editor dependent on the visual information of your java, it’s also dependent on HOW YOU CREATED IT.

I’d love to hear an explanation for this one. You have the entire visual snippet artifact, why isn’t the backing java just built off of that on every save?

Author: dan

Leave a Reply

Your email address will not be published. Required fields are marked *