@Override public ExportedDocument read() throws IOException { if (doc != null) { if (readDone && !enableRepeatedReads) { return null; } else { readDone = true; return new ExportedDocumentImpl(doc); } } doc = null; return null; }
if (pathSegmentsToRemove > 0) { result = new ExportedDocumentImpl(docModel, docModel.getPath().removeFirstSegments(pathSegmentsToRemove), inlineBlobs); } else { result = new ExportedDocumentImpl(docModel, inlineBlobs); path = path.removeFirstSegments(pathSegmentsToRemove); result.setPath(path);
protected void readDocument(DocumentModel doc, boolean inlineBlobs) throws IOException { document = DocumentFactory.getInstance().createDocument(); document.setName(doc.getName()); Element rootElement = document.addElement(ExportConstants.DOCUMENT_TAG); rootElement.addAttribute(ExportConstants.REP_NAME, doc.getRepositoryName()); rootElement.addAttribute(ExportConstants.ID_ATTR, doc.getRef().toString()); Element systemElement = rootElement.addElement(ExportConstants.SYSTEM_TAG); systemElement.addElement(ExportConstants.TYPE_TAG).addText(doc.getType()); systemElement.addElement(ExportConstants.PATH_TAG).addText(path.toString()); // lifecycle readLifeCycleInfo(systemElement, doc); // facets readFacets(systemElement, doc); // write security Element acpElement = systemElement.addElement(ExportConstants.ACCESS_CONTROL_TAG); ACP acp = doc.getACP(); if (acp != null) { readACP(acpElement, acp); } // write schemas readDocumentSchemas(rootElement, doc, inlineBlobs); }
ComplexType ctype = (ComplexType) type; if (TypeConstants.isContentType(ctype)) { readBlob(element, ctype, (Blob) value, inlineBlobs); } else { readComplex(element, ctype, (Map) value, inlineBlobs); readList(element, (ListType) type, (List) value, inlineBlobs); } else if (value.getClass().getComponentType() != null) { readList(element, (ListType) type, PrimitiveArrays.toList(value), inlineBlobs); } else { throw new IllegalArgumentException("A value of list type is neither list neither array: " + value);
@Override public void updateExport(DocumentModel docModel, ExportedDocumentImpl result) throws Exception { if (docModel.isLocked()) { Element lockElement = result.getDocument().getRootElement().addElement("lockInfo"); Lock lock = docModel.getLockInfo(); Long created = lock.getCreated().getTimeInMillis(); String owner = lock.getOwner(); lockElement.addElement("created").setText(created.toString()); ; lockElement.addElement("owner").setText(owner.toString()); ; } }
/** * @param path the path to use for this document this is used to remove full paths */ public ExportedDocumentImpl(DocumentModel doc, Path path, boolean inlineBlobs) throws IOException { id = doc.getId(); if (path == null) { this.path = new Path(""); } else { this.path = path.makeRelative(); } readDocument(doc, inlineBlobs); srcLocation = new DocumentLocationImpl(doc); }
@Override public void updateExport(DocumentModel docModel, ExportedDocumentImpl result) throws Exception { Element versionElement = result.getDocument().getRootElement().addElement("version");
@Override public ExportedDocument read() throws IOException { if (iterator.hasNext()) { DocumentModel docModel = iterator.next(); return new ExportedDocumentImpl(docModel, inlineBlobs); } return null; }
@Override public ExportedDocument read() throws IOException { if (docList == null || docList.isEmpty()) { return null; } return new ExportedDocumentImpl(docList.remove(0)); }
@Override public ExportedDocument read() throws IOException { if (docList == null || docList.isEmpty()) { return null; } return new ExportedDocumentImpl(docList.remove(0)); }
@Override public ExportedDocument read() throws IOException { if (iterator.hasNext()) { DocumentModel docModel = iterator.next(); if (pathSegmentsToRemove > 0) { // remove unwanted leading segments return new ExportedDocumentImpl(docModel, docModel.getPath().removeFirstSegments(pathSegmentsToRemove), inlineBlobs); } else { return new ExportedDocumentImpl(docModel, inlineBlobs); } } return null; }
private ExportedDocument createDocument(ZipEntry dirEntry) throws IOException { ExportedDocument xdoc = new ExportedDocumentImpl(); String dirPath = dirEntry.getName(); // TODO -> some processing on the path? xdoc.setPath(new Path(dirPath).removeTrailingSeparator()); // read the main document ZipEntry entry = zip.getEntry(dirPath + ExportConstants.DOCUMENT_FILE); InputStream in = zip.getInputStream(entry); try { Document doc = readXML(in); doc.setDocument(doc); } finally { in.close(); } return null; }
ExportedDocument xdoc = new ExportedDocumentImpl(); xdoc.setPath(new Path("/")); xdoc.setDocument(loadXML(entry)); ExportedDocument xdoc = new ExportedDocumentImpl(); xdoc.setPath(new Path(name).removeTrailingSeparator()); for (int i = 0; i < count; i++) {
ExportedDocument xdoc = new ExportedDocumentImpl(); xdoc.setPath(new Path("/")); xdoc.setDocument(loadXML(entry)); ExportedDocument xdoc = new ExportedDocumentImpl(); xdoc.setPath(new Path(name).removeTrailingSeparator()); for (String childEntryName : childEntries) {
ExportedDocument xdoc = new ExportedDocumentImpl(); for (File file : dir.listFiles()) { if (file.isFile()) {