Package org.damour.base.client.objects

Examples of org.damour.base.client.objects.Folder


          fileObject = new File();
        }
        fileObject.setOwner(owner);

        String parentFolderId = request.getParameter("parentFolder");
        Folder parentFolder = null;
        if (parentFolderId != null && !"".equals(parentFolderId)) {
          parentFolder = (Folder) session.load(Folder.class, new Long(parentFolderId));
          if (!SecurityHelper.doesUserHavePermission(session, owner, parentFolder, PERM.WRITE)) {
            Cookie cookie = new Cookie(item.getFieldName(), "");
            cookie.setMaxAge(0);
View Full Code Here


  public void createFolderTest() {
    String name = "test-folder-name";
    String descrption = "test-folder-description";
    Session session = HibernateUtil.getInstance().getSession();
    Transaction tx = session.beginTransaction();
    Folder folder = new Folder();
    folder.setName(name);
    folder.setDescription(descrption);
    session.save(folder);
    tx.commit();
    session.close();

    session = HibernateUtil.getInstance().getSession();
    folder = SecurityHelper.getFolder(session, null, name);
    session.close();
    assertEquals(folder.getName(), name);
    assertEquals(folder.getDescription(), descrption);
  }
View Full Code Here

    String childFolderName = "child-folder-name";
    String childFolderDescription = "child-folder-description";

    Session session = HibernateUtil.getInstance().getSession();
    Transaction tx = session.beginTransaction();
    Folder parentFolder = new Folder();
    parentFolder.setName(parentName);
    parentFolder.setDescription(parentDescription);
    session.save(parentFolder);
    Folder childFolder = new Folder();
    childFolder.setParent(parentFolder);
    childFolder.setName(childFolderName);
    childFolder.setDescription(childFolderDescription);
    session.save(childFolder);
    tx.commit();
    session.close();

    session = HibernateUtil.getInstance().getSession();
    childFolder = SecurityHelper.getFolder(session, parentFolder, childFolderName);
    session.close();
    assertEquals(childFolder.getName(), childFolderName);
    assertEquals(childFolder.getDescription(), childFolderDescription);
  }
View Full Code Here

  public void deleteFolderTest() {
    String name = "test-folder-name";
    String descrption = "test-folder-description";
    Session session = HibernateUtil.getInstance().getSession();
    Transaction tx = session.beginTransaction();
    Folder folder = new Folder();
    folder.setName(name);
    folder.setDescription(descrption);
    session.save(folder);
    tx.commit();
    session.close();

    session = HibernateUtil.getInstance().getSession();
View Full Code Here

        if (permissibleObject instanceof File) {
          File file = (File) permissibleObject;
          file.setName(nameTextBox.getText());
          BaseServiceCache.getService().renameFile(file, renameCallback);
        } else if (permissibleObject instanceof Folder) {
          Folder folder = (Folder) permissibleObject;
          folder.setName(nameTextBox.getText());
          BaseServiceCache.getService().renameFolder(folder, renameCallback);
        }
      }

      public void cancelPressed() {
View Full Code Here

    permissibleObject = ((PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId()));

    try {
      if (permissibleObject instanceof Folder) {
        Folder folder = (Folder) permissibleObject;
        if (!authUser.isAdministrator() && !authUser.equals(folder.getOwner())) {
          throw new SimpleMessageException("User is not authorized to delete this object.");
        }
        FolderHelper.deleteFolder(session.get(), folder);
      } else {
        if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.WRITE)) {
View Full Code Here

      }
      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, newFolder.getParent(), PERM.WRITE)) {
        throw new SimpleMessageException("User is not authorized to create a new folder here.");
      }
      if (newFolder.getId() != null) {
        Folder hibNewFolder = (Folder) session.get().load(Folder.class, newFolder.getId());
        if (hibNewFolder != null) {
          if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, hibNewFolder, PERM.WRITE)) {
            throw new SimpleMessageException("User is not authorized to save a new folder here.");
          }
          hibNewFolder.setName(newFolder.getName());
          hibNewFolder.setDescription(newFolder.getDescription());
          hibNewFolder.setParent(newFolder.getParent());
          newFolder = hibNewFolder;
        }
      }

      newFolder.setOwner(authUser);
View Full Code Here

    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }
    Transaction tx = session.get().beginTransaction();
    try {
      Folder hibfolder = (Folder) session.get().load(Folder.class, folder.getId());
      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, hibfolder, PERM.WRITE)) {
        throw new SimpleMessageException("User is not authorized to rename this folder.");
      }
      hibfolder.setName(folder.getName());
      session.get().save(hibfolder);
      tx.commit();
    } catch (Throwable t) {
      Logger.log(t);
      try {
View Full Code Here

          public void onSuccess(Folder newFolder) {
            repositoryTree.setLastItemId(newFolder.getId());
            repositoryTree.fetchRepositoryTree(repositoryCallback);
          }
        };
        Folder newFolder = new Folder();
        newFolder.setParent(parentFolder);
        newFolder.setName(folderNameTextBox.getText());
        newFolder.setDescription(folderNameTextBox.getText());
        BaseServiceCache.getService().createNewFolder(newFolder, callback);
      }

      public void cancelPressed() {
      }
View Full Code Here

      parent.setSelected(true);
      lastItem = parent;
    }

    if (permissibleObject instanceof Folder) {
      Folder myFolder = (Folder) permissibleObject;
      if (myFolder.getId().equals(folderIdToOpen)) {
        parent.setState(true);
      }
    }
    // do children
    for (int i = 0; i < parent.getChildCount(); i++) {
View Full Code Here

TOP

Related Classes of org.damour.base.client.objects.Folder

Copyright © 2018 www.massapicom. 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.