Projects >> nuxeo-core >>569d6c343e5522041f2498deb0f6209f61e0ab89

Chunk
Conflicting content
        list = remote.getChildren(root.getRef());
        assertEquals(1, list.size());

<<<<<<< HEAD
        // create folder to hold proxies
        DocumentModel folder = new DocumentModelImpl(root.getPathAsString(),
                "folder", "Folder");
        folder = remote.createDocument(folder);
        remote.save();
        folder = remote.getDocument(folder.getRef());

        // publishDocument API
        proxy = remote.publishDocument(doc, root);
        remote.save(); // needed for publish-by-copy to work
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());
        assertTrue(proxy.isProxy());

        // republish a proxy
        DocumentModel proxy2 = remote.publishDocument(proxy, folder);
        remote.save();
        assertTrue(proxy2.isProxy());
        assertEquals(1, remote.getChildrenRefs(folder.getRef(), null).size());
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());

        // a second time to check overwrite
        // XXX this test fails for mysterious reasons (hasNode doesn't detect
        // the child node that was added by the first copy -- XASession pb?)
        // remote.publishDocument(proxy, folder);
        // remote.save();
        // assertEquals(1, remote.getChildrenRefs(folder.getRef(),
        // null).size());
        // assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());

        // and without overwrite
        remote.publishDocument(proxy, folder, false);
        remote.save();
        assertEquals(2, remote.getChildrenRefs(folder.getRef(), null).size());
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());
=======
>>>>>>> d7caa73e023f1d840448fc42986ee81c5f64ea67
    }
}
Solution content
        list = remote.getChildren(root.getRef());
        assertEquals(1, list.size());

        // create folder to hold proxies
        DocumentModel folder = new DocumentModelImpl(root.getPathAsString(),
                "folder", "Folder");
        folder = remote.createDocument(folder);
        remote.save();
        folder = remote.getDocument(folder.getRef());

        // publishDocument API
        proxy = remote.publishDocument(doc, root);
        remote.save(); // needed for publish-by-copy to work
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());
        assertTrue(proxy.isProxy());

        // republish a proxy
        DocumentModel proxy2 = remote.publishDocument(proxy, folder);
        remote.save();
        assertTrue(proxy2.isProxy());
        assertEquals(1, remote.getChildrenRefs(folder.getRef(), null).size());
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());

        // a second time to check overwrite
        // XXX this test fails for mysterious reasons (hasNode doesn't detect
        // the child node that was added by the first copy -- XASession pb?)
        // remote.publishDocument(proxy, folder);
        // remote.save();
        // assertEquals(1, remote.getChildrenRefs(folder.getRef(),
        // null).size());
        // assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());

        // and without overwrite
        remote.publishDocument(proxy, folder, false);
        remote.save();
        assertEquals(2, remote.getChildrenRefs(folder.getRef(), null).size());
        assertEquals(3, remote.getChildrenRefs(root.getRef(), null).size());
    }
}
File
TestLocalAPI.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
        }
=======
        /*
            DocumentModel section, boolean overwriteExistingProxy)
            throws ClientException {

<<<<<<< HEAD
        DocumentRef docRef = docToPublish.getRef();
        DocumentRef sectionRef = section.getRef();
        if (docToPublish.isProxy()) {
            try {
                Document doc = resolveReference(docRef);
                Document sec = resolveReference(sectionRef);
                checkPermission(doc, READ);
                checkPermission(sec, ADD_CHILDREN);

                if (overwriteExistingProxy) {
                    removeExistingProxies(doc, sec);
                }

                // publishing a proxy is just a copy
                // TODO copy also copies security. just recreate a proxy
                DocumentModel newDocument = copy(docRef, sectionRef,
                        docToPublish.getName());

                Map options = new HashMap();
                options.put(CoreEventConstants.DOCUMENT, newDocument);
                notifyEvent(DocumentEventTypes.DOCUMENT_PROXY_PUBLISHED,
                        newDocument, options, null, null, true);

                options.put(CoreEventConstants.DOCUMENT, section);
                notifyEvent(DocumentEventTypes.SECTION_CONTENT_PUBLISHED,
                        section, options, null, null, true);

                return newDocument;
            } catch (DocumentException e) {
                throw new ClientException(e);
            }
        } else {
            // prepare document for creating snapshot
            docToPublish.putContextData(
                    VersioningDocument.CREATE_SNAPSHOT_ON_SAVE_KEY, true);
            // snapshot the document
            createDocumentSnapshot(docToPublish);
            VersionModel version = getLastVersion(docRef);
            DocumentModel newProxy = createProxy(sectionRef, docRef, version,
                    overwriteExistingProxy);
            return newProxy;
        // we cannot publish a proxy doc
        DocumentRef docRef = docToPublish.getRef();
        try {
            Document doc = resolveReference(docRef);
            if (doc.isProxy()) {
                throw new InvalidProxyDocOperation(
                        "proxy document cannot be published");
            }
        } catch (DocumentException e) {
            throw new ClientException(e);
        }

        // prepare document for creating snapshot
        docToPublish.putContextData(
                VersioningDocument.CREATE_SNAPSHOT_ON_SAVE_KEY, true);
        // snapshot the document
        createDocumentSnapshot(docToPublish);

        VersionModel version = getLastVersion(docToPublish.getRef());
        DocumentModel newProxy = createProxy(section.getRef(),
                docToPublish.getRef(), version, overwriteExistingProxy);

        return newProxy;
>>>>>>> d7caa73e023f1d840448fc42986ee81c5f64ea67

         * -- this cannot resolve unwanted transition 'approved -> project'
Solution content
            try {
            DocumentModel section, boolean overwriteExistingProxy)
            throws ClientException {

        DocumentRef docRef = docToPublish.getRef();
        DocumentRef sectionRef = section.getRef();
        if (docToPublish.isProxy()) {
                Document doc = resolveReference(docRef);
                Document sec = resolveReference(sectionRef);
                checkPermission(doc, READ);
                checkPermission(sec, ADD_CHILDREN);

                if (overwriteExistingProxy) {
                    removeExistingProxies(doc, sec);
                }

                // publishing a proxy is just a copy
                // TODO copy also copies security. just recreate a proxy
                DocumentModel newDocument = copy(docRef, sectionRef,
                        docToPublish.getName());

                Map options = new HashMap();
                options.put(CoreEventConstants.DOCUMENT, newDocument);
                notifyEvent(DocumentEventTypes.DOCUMENT_PROXY_PUBLISHED,
                        newDocument, options, null, null, true);

                options.put(CoreEventConstants.DOCUMENT, section);
                notifyEvent(DocumentEventTypes.SECTION_CONTENT_PUBLISHED,
                        section, options, null, null, true);

                return newDocument;
            } catch (DocumentException e) {
                throw new ClientException(e);
            }
        } else {
            // prepare document for creating snapshot
            docToPublish.putContextData(
                    VersioningDocument.CREATE_SNAPSHOT_ON_SAVE_KEY, true);
            // snapshot the document
            createDocumentSnapshot(docToPublish);
            VersionModel version = getLastVersion(docRef);
            DocumentModel newProxy = createProxy(sectionRef, docRef, version,
                    overwriteExistingProxy);
            return newProxy;
        }

        /*
         * -- this cannot resolve unwanted transition 'approved -> project'
File
AbstractSession.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Return statement
Try statement
Variable