Examples of FolderService


Examples of org.palo.viewapi.services.FolderService

  public XStaticFolder createFolder(String sessionId, String name, XStaticFolder xParent)
      throws DbOperationFailedException, SessionExpiredException {
    try {
      ExplorerTreeNode root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
      FolderService folderService = ServiceProvider
          .getFolderService(getLoggedInUser(sessionId));
      ExplorerTreeNode parentNode = find(root, xParent.getId());
//      ExplorerTreeNode parentNode = folderService.getTreeNode(xParent
//          .getId());
      StaticFolder staticFolder = folderService.createStaticFolder(name,
          parentNode, null);
//      folderService.save(staticFolder.getRoot());
      XStaticFolder xStaticFolder = new XStaticFolder(staticFolder
          .getId(), staticFolder.getName());
      xStaticFolder.setHasChildren(false);
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

  public void deleteFolder(String sessionId, XStaticFolder xFolder)
      throws DbOperationFailedException, SessionExpiredException {
    try {
      ExplorerTreeNode root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
      FolderService folderService = ServiceProvider
          .getFolderService(getLoggedInUser(sessionId));
      ExplorerTreeNode folder = find(root, xFolder.getId());
//      FolderService folderService = ServiceProvider
//          .getFolderService(getLoggedInUser());
//      ExplorerTreeNode folder = folderService
//          .getTreeNode(xFolder.getId());
      if (folder != null) {
        deleteContentof(sessionId, folder);
        folderService.delete(folder);
        //folderService.save(folder.getRoot());
        saveRoot(sessionId, root);
      }
    } catch (OperationFailedException e) {
      UserSession userSession = getUserSession(sessionId);
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

    }
  }
 
  private final void deleteContentof(String sessionId, ExplorerTreeNode folder)
      throws OperationFailedException, SessionExpiredException {
    FolderService folderService = ServiceProvider
        .getFolderService(getLoggedInUser(sessionId));
    for (ExplorerTreeNode child : folder.getChildren()) {
      if (child instanceof StaticFolder) {
        deleteFolder(sessionId, folderService, (StaticFolder) child);
      }
      View view = getViewFrom(child);
      if (view != null)
        delete(sessionId, view);
      folderService.delete(child);
    }
  }
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

  public void deleteFolderElement(String sessionId, XFolderElement xFolderElement)
      throws DbOperationFailedException, SessionExpiredException {
    try {
      ExplorerTreeNode root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
      FolderService folderService = ServiceProvider
          .getFolderService(getLoggedInUser(sessionId));
      ExplorerTreeNode folder = find(root, xFolderElement.getId());
     
//      FolderService folderService = ServiceProvider
//          .getFolderService(getLoggedInUser());
//      ExplorerTreeNode folder = folderService.getTreeNode(xFolderElement
//          .getId());
      if (folder != null) {
        folderService.delete(folder);
//        folderService.save(folder.getRoot());
        saveRoot(sessionId, root);
      }
    } catch (OperationFailedException e) {
      e.printStackTrace();
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

      roleMgmt.insert(editorRole);
    }
   
    if (fe != null) {
    try {
      FolderService folderService = ServiceProvider
        .getFolderService(getLoggedInUser(sessionId));
      if (!fe.hasRole(viewerRole) && isPublic) {
        try {
          folderService.add(viewerRole, fe);
        } catch (OperationFailedException e) {
          e.printStackTrace();
        }
      }
      if (!fe.hasRole(editorRole) && isEditable) {
        try {
          folderService.add(editorRole, fe);
        } catch (OperationFailedException e) {
          e.printStackTrace();
        }
      }
      ExplorerTreeNode nd = fe.getParent();
      while (nd != null) {
        if (!nd.hasRole(viewerRole) && isPublic) {
          try {
            folderService.add(viewerRole, nd);
          } catch (OperationFailedException e) {
            e.printStackTrace();
          }
        }
        if (!nd.hasRole(editorRole) && isEditable) {
          try {
            folderService.add(editorRole, nd);
          } catch (OperationFailedException e) {
            e.printStackTrace();
          }         
        }
        nd = nd.getParent();
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

      SessionExpiredException {
    FolderElement fe = null;
    try {
//      CubeViewReader.CHECK_RIGHTS = false;
      ExplorerTreeNode root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
      FolderService folderService = ServiceProvider
          .getFolderService(getLoggedInUser(sessionId))
      ExplorerTreeNode parent = find(root, parentFolder.getId());
      fe = folderService.createFolderElement(xView.getName(),
          parent, null);
      View view = getView(sessionId, xView);
      try {
        assignViewerAndEditorRole(sessionId, fe, view, isPublic, isEditable);
      } catch (SQLException e) {
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

  }
   
  private final void saveRoot(String sessionId, ExplorerTreeNode root) throws SessionExpiredException {
    try {
      AuthUser user = getLoggedInUser(sessionId);
      FolderService folderService = ServiceProvider.getFolderService(user);   
      Role viewerRole = null;
      for (Role role: user.getRoles()) {
        if (role.getName().equalsIgnoreCase("viewer")) {
          viewerRole = role;
          break;
        }
      }
      if (viewerRole == null) {
        for (Group g: user.getGroups()) {
          for (Role role: g.getRoles()) {
            if (role.getName().equalsIgnoreCase("viewer")) {
              viewerRole = role;
              break;
            }
          }
        }
      }
      if (viewerRole != null) {
        ensureRoles(folderService, root, viewerRole);
      }
      FolderModel.getInstance().save(user, root);
      folderService.save(root);
    } catch (OperationFailedException e) {
      e.printStackTrace();
    } catch (PaloIOException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

  public final void move(String sessionId, XObject[] xObjects,
      XStaticFolder toXFolder) throws DbOperationFailedException,
      SessionExpiredException {
    try {
      ExplorerTreeNode root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
      FolderService folderService = ServiceProvider
          .getFolderService(getLoggedInUser(sessionId));
      ExplorerTreeNode folder = find(root, toXFolder.getId());
      for (XObject xObject: xObjects) {
        ExplorerTreeNode folderElement = find(root, xObject.getId());
        folderElement.setParent(folder);
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

//  }

  public void renameFolderElement(String sessionId, XFolderElement xFolderElement,
      String newName) throws DbOperationFailedException,
      SessionExpiredException {
    FolderService folderService = ServiceProvider
        .getFolderService(getLoggedInUser(sessionId));     
//      ExplorerTreeNode folder = folderService.getTreeNode(xFolderElement
//          .getId());
    ExplorerTreeNode root = null;
    try {
      root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
    } catch (PaloIOException e) {
      // TODO Auto-generated catch block
    }
    if (root == null) {
      return;
    }
    ExplorerTreeNode folder = find(root, xFolderElement.getId());
    if (folder != null) {
      folderService.setName(newName, folder);
      //folderService.save(folder.getRoot());
      saveRoot(sessionId, root);
    }
  }
View Full Code Here

Examples of org.palo.viewapi.services.FolderService

    }
  }
   
  public void renameFolder(String sessionId, XStaticFolder folder, String newName) throws DbOperationFailedException,
      SessionExpiredException {
    FolderService folderService = ServiceProvider
      .getFolderService(getLoggedInUser(sessionId));
    AuthUser user = getLoggedInUser(sessionId);
    boolean mayWrite = false;
    for (Role r: user.getRoles()) {
      if (r.hasPermission(Right.WRITE)) {
        mayWrite = true;
        break;
      }
    }
    if (!mayWrite) {
      for (Group g: user.getGroups()) {
        for (Role r: g.getRoles()) {
          if (r.hasPermission(Right.WRITE)) {
            mayWrite = true;
            break;
          }         
        }
      }
    }
    if (!mayWrite) {
      throw new DbOperationFailedException("Not enough rights to rename folder '" +
          folder.getName() + "'.");
    }
    //    ExplorerTreeNode folder = folderService.getTreeNode(xFolderElement
    //        .getId());
    ExplorerTreeNode root = null;
    try {
      root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
    } catch (PaloIOException e) {
      //   TODO Auto-generated catch block
    }
    if (root == null) {
      return;
    }
    ExplorerTreeNode fold = find(root, folder.getId());
    if (fold != null) {
      folderService.setName(newName, fold);
      saveRoot(sessionId, root);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.