Ejemplo n.º 1
0
  /**
   * See CMIS 1.0 section 2.2.4.2 createDocumentFromSource
   *
   * @throws CmisStorageException
   */
  public JcrNode addNodeFromSource(JcrDocument source, Properties properties) {
    try {
      String destPath = PathManager.createCmisPath(getNode().getPath(), source.getName());
      Session session = getNode().getSession();

      session.getWorkspace().copy(source.getNode().getPath(), destPath);
      JcrNode jcrNode = create(session.getNode(destPath));

      // overlay new properties
      if (properties != null && properties.getProperties() != null) {
        updateProperties(jcrNode.getNode(), jcrNode.getTypeId(), properties);
      }

      session.save();
      return jcrNode;
    } catch (RepositoryException e) {
      log.debug(e.getMessage(), e);
      throw new CmisStorageException(e.getMessage(), e);
    }
  }