Retrieves a document from the repository given the file name and the unique ID of its parent folder.
private List<String> getPropertiesToRead() {
List<String> props = new List<String>();
//the list of all available properties displays below but to increase efficiency in your searches, you can omit unnecessary properties from your application and those values will not be returned
props.add("version");
props.add("subject");
props.add("categories");
props.add("createdOn");
props.add("createdBy");
props.add("modifiedBy");
props.add("modifiedOn");
props.add("name");
props.add("author");
props.add("authorDate");
props.add("size");
//the contentType is only relevant to a document of type FILE
props.add("contentType");
//the contentType is only relevant to a document of type FILE
props.add("content");
props.add("type");
props.add("parentFolder");
props.add("checkedOutBy");
props.add("checkedOutOn");
props.add("checkedInBy");
props.add("checkedInOn");
props.add("versionText");
//the url is only relevant to a document of type HYPERLINK
props.add("url");
//the contentType is only relevant to a document of type SHORTCUT
props.add("shortcutToDocument");
return props;
}
private Document readChildDocumentForName() throws Exception {
//the first parameter, parentUniqueKey, identifies the unique key of the parent folder whose child documents' properties to return; where child documents would include files, subfolders, hyperlinks, and shortcuts included in the parent folder recursively
//the second parameter identifies the target document file name, including file extension
List<Document> readChildDocumentForName = documentRepository.readChildDocuments("DOCU_2789", "invoice101009_4009_attachment.doc", getPropertiesToRead());
return readChildDocument;
}