コード例 #1
0
 @Override
 public ShareableResource<NodeDetail> getResource() {
   NodeBm nodeBm = EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBm.class);
   NodeDetail node =
       nodeBm.getDetail(new NodePK(String.valueOf(getSharedObjectId()), getComponentId()));
   if (node != null) {
     return new ShareableNode(getToken(), node);
   }
   return null;
 }
コード例 #2
0
  /** Returns the access path of the object. */
  private String getPath(String componentId, String nodeId, String language) {
    String path = "";

    // Space > SubSpace
    if (componentId != null && !"useless".equals(componentId)) {
      List<SpaceInst> listSpaces = organizationController.getSpacePathToComponent(componentId);
      for (SpaceInst space : listSpaces) {
        path += space.getName(language) + " > ";
      }

      // Service
      path += organizationController.getComponentInstLight(componentId).getLabel(language);

      // Theme > SubTheme
      String pathString = "";
      if (nodeId != null) {
        NodeBm nodeBm = null;
        try {
          NodeBmHome nodeBmHome =
              EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBmHome.class);
          nodeBm = nodeBmHome.create();
        } catch (Exception e) {
          SilverTrace.error(
              "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_CREATE_NODEBM_HOME", e);
        }

        if (nodeBm != null) {
          NodePK nodePk = new NodePK(nodeId, componentId);
          Collection<NodeDetail> listPath = null;
          try {
            listPath = nodeBm.getPath(nodePk);
          } catch (RemoteException e) {
            SilverTrace.error(
                "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_GET_PATH_NODE", nodeId);
          }

          if (listPath != null) {
            Collections.reverse((List<NodeDetail>) listPath);
            String nodeName;
            for (NodeDetail nodeInPath : listPath) {
              if (!nodeInPath.getNodePK().getId().equals("0")) {
                if (language != null) {
                  nodeName = nodeInPath.getName(language);
                } else {
                  nodeName = nodeInPath.getName();
                }
                pathString += nodeName + " > ";
              }
            }

            if (StringUtil.isDefined(pathString)) {
              pathString = pathString.substring(0, pathString.length() - 3); // remove last '>'
            }
          }
        }
      }

      if (pathString.length() > 0) {
        path += " > " + pathString;
      }
    }

    return path;
  }