public Node getSelectedTag(String tagName) throws Exception {
    NewFolksonomyService newFolksonomyService = getApplicationComponent(NewFolksonomyService.class);
    NodeHierarchyCreator nodeHierarchyCreator = getApplicationComponent(NodeHierarchyCreator.class);
    UIJCRExplorer uiExplorer = getAncestorOfType(UIJCRExplorer.class);
    UITaggingForm uiTaggingForm = getChild(UITaggingForm.class);

    String workspace = uiExplorer.getRepository().getConfiguration().getDefaultWorkspaceName();
    String userName = uiExplorer.getSession().getUserID();
    String tagScope = uiTaggingForm.getUIFormSelectBox(UITaggingForm.TAG_SCOPES).getValue();
    int scope = uiTaggingForm.getIntValue(tagScope);
    uiExplorer.setTagScope(scope);

    String publicTagNodePath = nodeHierarchyCreator.getJcrPath(UITaggingForm.PUBLIC_TAG_NODE_PATH);

    List<Node> tagList =
        (scope == NewFolksonomyService.PUBLIC)
            ? newFolksonomyService.getAllPublicTags(publicTagNodePath, workspace)
            : newFolksonomyService.getAllPrivateTags(userName);

    for (Node tag : tagList) if (tag.getName().equals(tagName)) return tag;
    return null;
  }
  private List<DocumentNode> getDocumentData(List<Node> lstNode, String noOfItem) throws Exception {
    if (lstNode == null || lstNode.size() == 0) return null;
    List<DocumentNode> lstDocNode = new ArrayList<DocumentNode>();
    DocumentNode docNode = null;
    StringBuilder tags = null;

    Collections.sort(
        lstNode,
        new PropertyValueComparator(DATE_MODIFIED, PropertyValueComparator.DESCENDING_ORDER));
    ManageableRepository manageableRepository = repositoryService.getCurrentRepository();
    List<DriveData> lstDrive = manageDriveService.getAllDrives();
    for (Node node : lstNode) {
      docNode = new DocumentNode();
      docNode.setName(node.getName());
      docNode.setPath(node.getPath());
      docNode.setLastAuthor(node.getProperty(EXO_OWNER).getString());
      docNode.setLstAuthor(node.getProperty(EXO_OWNER).getString());
      docNode.setDateEdited(getDateFormat(node.getProperty(DATE_MODIFIED).getDate()));
      tags = new StringBuilder(1024);

      List<Node> tagList =
          newFolksonomyService.getLinkedTagsOfDocumentByScope(
              NewFolksonomyService.PUBLIC,
              "",
              node,
              manageableRepository.getConfiguration().getDefaultWorkspaceName());
      for (Node tag : tagList) {
        tags.append(tag.getName()).append(", ");
      }

      if (tags.lastIndexOf(",") > 0) {
        tags.delete(tags.lastIndexOf(","), tags.length());
      }

      docNode.setTags(tags.toString());
      docNode.setDriveName(getDriveName(lstDrive, node));
      if (lstDocNode.size() < Integer.parseInt(noOfItem)) lstDocNode.add(docNode);
    }
    return lstDocNode;
  }