Package org.modeshape.jcr.spi.federation

Examples of org.modeshape.jcr.spi.federation.DocumentWriter.document()


            writer.setPrimaryType("nt:unstructured");
            writer.setParent(generatedOutId);
            writer.addProperty("prop1", "value1");
            writer.addProperty("prop2", "value2");
            newDocs.add(new DocInfo(writer.document(), newId, newPath));
            DocumentReader reader = readDocument(writer.document());
            changes.nodeCreated(newId, documentId, newPath, JcrNtLexicon.UNSTRUCTURED, Collections.<Name>emptySet(),
                                reader.getProperties(), isQueryable());

            // And some children ...
            for (int i = 0; i != 3; ++i) {
View Full Code Here


                childWriter.setParent(newId);
                childWriter.addProperty("prop1", "value1");
                childWriter.addProperty("prop2", "value2");
                childWriter.setParent(newId);
                writer.addChild(childId, childName);
                newDocs.add(new DocInfo(childWriter.document(), childId, childPath));
                DocumentReader childReader = readDocument(writer.document());
                changes.nodeCreated(childId, newId, childPath, JcrNtLexicon.UNSTRUCTURED, Collections.<Name>emptySet(),
                                    childReader.getProperties(), isQueryable());
            }
View Full Code Here

            String oldId = readDocument(oldDoc).getDocumentId();

            // Remove the child reference from '/doc{n}/generate-out' to the node we'll remove ...
            DocumentWriter generatedOutWriter = writeDocument(generatedOutDoc);
            generatedOutWriter.removeChild(oldId);
            persistDocument(generatedOutId, generatedOutWriter.document());

            // Remove the document at '/doc{n}/generate-out/{name}' ...
            removeDocument(oldId);
            changes.nodeRemoved(oldId, documentId, oldPath, JcrNtLexicon.UNSTRUCTURED, Collections.<Name>emptySet(),
                                isQueryable());
View Full Code Here

        if (PAGED_DOCUMENT_ID.equals(id)) {
            DocumentReader reader = readDocument(doc);
            List<? extends Document> children = reader.getChildren();
            DocumentWriter writer = newDocument(id).setPrimaryType(JcrNtLexicon.UNSTRUCTURED).setChildren(children.subList(0, 1))
                                                   .addPage(reader.getDocumentId(), 1, 1, children.size());
            return writer.document();
        }
        return doc;
    }

    @Override
View Full Code Here

        updateParents(existingDocumentReader, updatedDocumentWriter, documentChanges);
        if (!existingDocumentReader.isQueryable()) {
            updatedDocumentWriter.setNotQueryable();
        }

        persistDocument(id, updatedDocumentWriter.document());
    }

    protected void persistDocument( String id,
                                    Document doc ) {
        documentsById.put(id, doc);
View Full Code Here

        int blockSize = (int)pageKey.getBlockSize();
        int offset = pageKey.getOffsetInt();

        DocumentWriter writer = newDocument(parentId).setChildren(children.subList(offset, offset + blockSize));
        if (offset + blockSize == children.size()) {
            return writer.document();
        }
        return writer.addPage(parentId, offset + 1, blockSize, children.size()).document();
    }
}
View Full Code Here

        if (addMimeTypeMixin) {
            writer.addMixinType(MIX_MIME_TYPE);
        }

        // Return the document ...
        return writer.document();
    }

    private DateTime createdTimeFor( File file ) {
        BasicFileAttributes basicFileAttributes = basicAttributesFor(file);
        return basicFileAttributes != null ? factories().getDateFactory().create(basicFileAttributes.creationTime().toMillis()) : factories().getDateFactory()
View Full Code Here

        // append repository information to the root node
        if (folder.isRootFolder()) {
            writer.addChild(ObjectId.toString(ObjectId.Type.REPOSITORY_INFO, ""), REPOSITORY_INFO_NODE_NAME);
        }
        return writer.document();
    }

    /**
     * Translates cmis document object to JCR node.
     *
 
View Full Code Here

        // document specific property conversation
        cmisProperties(doc, writer);
        writer.addChild(ObjectId.toString(ObjectId.Type.CONTENT, doc.getId()), JcrConstants.JCR_CONTENT);

        return writer.document();
    }

    /**
     * Converts binary content into JCR node.
     *
 
View Full Code Here

        Property<Object> lastModifiedBy = doc.getProperty(PropertyIds.LAST_MODIFIED_BY);

        writer.addProperty(JcrLexicon.LAST_MODIFIED, properties.jcrValues(lastModified));
        writer.addProperty(JcrLexicon.LAST_MODIFIED_BY, properties.jcrValues(lastModifiedBy));

        return writer.document();
    }

    /**
     * Converts CMIS object's properties to JCR node properties.
     *
 
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.