Exemplo n.º 1
0
  /** @return */
  private TransferManifestNormalNode createFolderNode(NodeRef parentFolder, String nodeName)
      throws Exception {
    TransferManifestNormalNode node = new TransferManifestNormalNode();
    String uuid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
    node.setNodeRef(nodeRef);
    node.setUuid(uuid);
    node.setType(ContentModel.TYPE_FOLDER);
    node.setAncestorType(ContentModel.TYPE_FOLDER);

    /** Get guest home */
    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc =
        new ChildAssociationRef(
            ContentModel.ASSOC_CONTAINS,
            parentFolder,
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
            node.getNodeRef(),
            true,
            -1);
    parents.add(primaryAssoc);
    node.setParentAssocs(parents);
    node.setParentPath(null);
    node.setPrimaryParentAssoc(primaryAssoc);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NODE_UUID, uuid);
    props.put(ContentModel.PROP_NAME, nodeName);
    node.setProperties(props);

    return node;
  }
Exemplo n.º 2
0
  /** @return */
  private void modifyParentNode(NodeRef parentFolder, TransferManifestNormalNode nodeToMove)
      throws Exception {

    String nodeName = (String) nodeToMove.getProperties().get(ContentModel.PROP_NAME);

    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc =
        new ChildAssociationRef(
            ContentModel.ASSOC_CONTAINS,
            parentFolder,
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
            nodeToMove.getNodeRef(),
            true,
            -1);
    parents.add(primaryAssoc);
    nodeToMove.setParentAssocs(parents);
    nodeToMove.setParentPath(null);
    nodeToMove.setPrimaryParentAssoc(primaryAssoc);
  }