Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.FolderIndex.addChild()


        return;
      }

      // rearrange
      oldParent.removeChild(child);
      newParent.addChild(child);
      child.setParent(newParent);

      // change the child's name
      child.setName(destFileName);
View Full Code Here


    // create a subtree containing all children
    FolderIndex sharedNode = new FolderIndex(fileNode.getParent(), fileNode.getFileKeys(),
        fileNode.getName());
    for (Index child : fileNode.getChildren()) {
      sharedNode.addChild(child);
      child.setParent(sharedNode);
    }

    // copy all user permissions
    for (UserPermission userPermission : fileNode.getUserPermissions()) {
View Full Code Here

      // add to the new parent
      FolderIndex newParent = (FolderIndex) userProfile.getFileByPath(context.getDestination()
          .getParentFile(), networkManager.getSession().getRoot());
      movedNode.setParent(newParent);
      newParent.addChild(movedNode);

      // validate
      if (!oldParent.canWrite()) {
        throw new ProcessExecutionException("No write access to the source directory");
      } else if (!newParent.canWrite()) {
View Full Code Here

        // relink them
        Index movedNode = userProfile.getFileById(context.getFileNodeKeys().getPublic());
        userProfile.getRoot().removeChild(movedNode);
        FolderIndex oldParent = (FolderIndex) userProfile.getFileById(oldParentKey);
        movedNode.setParent(oldParent);
        oldParent.addChild(movedNode);

        // update in DHT
        profileManager.readyToPut(userProfile, getID());
      } catch (NoSessionException | GetFailedException | PutFailedException e) {
        // ignore
View Full Code Here

      // When it's been added, add the index to the user profile, else, simply upldate it's md5 hash
      // there.
      if (parentNode.getChildByName(index.getName()) == null) {
        logger.debug("Newly shared file '{}' received.", index.getName());
        // file is new, link parent and new child
        parentNode.addChild(index);
        index.setParent(parentNode);
      } else {
        // copy the md5 parameter of the received file
        Index existing = parentNode.getChildByName(index.getName());
        if (existing.isFile() && index.isFile()) {
View Full Code Here

      }

      // TODO this is buggy! rather use list to check for containment instead of above if-statement
      // re-add file to user profile
      FolderIndex parent = (FolderIndex) profile.getFileById(parentIndexKey);
      parent.addChild(index);
      index.setParent(parent);

      try {
        profileManager.readyToPut(profile, getID());
      } catch (PutFailedException e) {
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.