- String path = null;
- int currAliasIndex = -1;
- if (akbNode.hasProperty(AkbNames.AKB_USED_CONNECTOR))
- path = akbNode.getProperty(AkbNames.AKB_USED_CONNECTOR)
- .getString();
-
- Session session = akbNode.getSession();
- if (path != null && session.nodeExists(path)) {
- for (int i = 0; i < definedAliases.size(); i++) {
- if (path.equals(definedAliases.get(i).getPath())) {
- currAliasIndex = i;
- break;
- }
- }
- // does not work
- // Node chosenAlias = session.getNode(path);
- // currAliasIndex = definedAliases.indexOf(chosenAlias);
- }
- return currAliasIndex;
+ if (itemNode.hasProperty(AkbNames.AKB_USED_CONNECTOR)) {
+ String aliasPath = itemNode.getProperty(
+ AkbNames.AKB_USED_CONNECTOR).getString();
+
+ if (!itemNode.getSession().nodeExists(aliasPath))
+ return -1;
+
+ Node alias = itemNode.getSession().getNode(aliasPath);
+ return aliasCmb.indexOf(alias.getProperty(Property.JCR_TITLE)
+ .getString());
+ } else
+ return -1;