Node node = session.getNodeByUUID(uuid);

    Workspace space = session.getWorkspace();
    Node targetNode = obtainNode(rootNode, "/app:company_home/app:user_homes/cm:admin/cm:test_space");

    try {

        String path = node.getPath();
        int index = path.lastIndexOf("/");
        String newPathName = path.substring(0, index);
        //newPathName = newPathName + "/" + node.getName();

        String tpath = targetNode.getPath();
        int tindex = tpath.lastIndexOf("/");
        String tnewPathName = tpath.substring(0, tindex);
        tnewPathName = tnewPathName + "/" + targetNode.getName();

        session.move(newPathName, newPathName);
        session.save();
        commit();

    } catch (ItemExistsException e) {
        e.printStackTrace();
    } catch (PathNotFoundException e) {
        e.printStackTrace();
    } catch (VersionException e) {
        e.printStackTrace();
    } catch (ConstraintViolationException e) {
        e.printStackTrace();
    } catch (LockException e) {
        e.printStackTrace();
    } catch (RepositoryException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }


我在类文件中编写的这段代码并未在Java中从一个绝对路径移动到目标路径。需要与JCR 1.0.jar一起使用Alfresco Server Repository的示例

最佳答案

您似乎正在将某些东西从newPathName移到newPathName。那不应该是:

session.move(path, newPathName);

10-06 09:50