public static Node getNodeSymLink(Node node) throws Exception { LinkManager linkManager = Util.getUIPortal().getApplicationComponent(LinkManager.class); Node realNode = null; if (linkManager.isLink(node)) { if (linkManager.isTargetReachable(node)) { realNode = linkManager.getTarget(node); } } else { realNode = node; } return realNode; }
/** * GetRealNode * * @param strRepository * @param strWorkspace * @param strIdentifier * @param cacheVisibility the visibility of cache * @return the required node/ the target of a symlink node / null if node was in trash. * @throws RepositoryException */ public static Node getRealNode( String strRepository, String strWorkspace, String strIdentifier, boolean isWCMBase, String cacheVisibility) throws RepositoryException { LinkManager linkManager = WCMCoreUtils.getService(LinkManager.class); Node selectedNode; if (isWCMBase) { selectedNode = getViewableNodeByComposer( strRepository, strWorkspace, strIdentifier, WCMComposer.BASE_VERSION, cacheVisibility); } else { selectedNode = getViewableNodeByComposer( strRepository, strWorkspace, strIdentifier, null, cacheVisibility); } if (selectedNode != null) { if (!org.exoplatform.ecm.webui.utils.Utils.isInTrash(selectedNode)) { if (linkManager.isLink(selectedNode)) { if (linkManager.isTargetReachable(selectedNode)) { selectedNode = linkManager.getTarget(selectedNode); if (!org.exoplatform.ecm.webui.utils.Utils.isInTrash(selectedNode)) { return selectedNode; } } } else { return selectedNode; } } } return null; }