System.out.println("\nCapabilities...");
System.out.println("---------------");
// Check what capabilities our repository supports
System.out.println("Printing repository capabilities...");
final RepositoryInfo repInfo = session.getRepositoryInfo();
RepositoryCapabilities cap = repInfo.getCapabilities();
System.out.println("\nNavigation Capabilities");
System.out.println("-----------------------");
System.out.println("Get descendants supported: "
+ (cap.isGetDescendantsSupported() ? "true" : "false"));
System.out.println("Get folder tree supported: "
+ (cap.isGetFolderTreeSupported() ? "true" : "false"));
System.out.println("\nObject Capabilities");
System.out.println("-----------------------");
System.out.println("Content Stream: " + cap.getContentStreamUpdatesCapability().value());
System.out.println("Changes: " + cap.getChangesCapability().value());
System.out.println("Renditions: " + cap.getRenditionsCapability().value());
System.out.println("\nFiling Capabilities");
System.out.println("-----------------------");
System.out.println("Multifiling supported: "
+ (cap.isMultifilingSupported() ? "true" : "false"));
System.out.println("Unfiling supported: " + (cap.isUnfilingSupported() ? "true" : "false"));
System.out.println("Version specific filing supported: "
+ (cap.isVersionSpecificFilingSupported() ? "true" : "false"));
System.out.println("\nVersioning Capabilities");
System.out.println("-----------------------");
System.out
.println("PWC searchable: " + (cap.isPwcSearchableSupported() ? "true" : "false"));
System.out.println("PWC Updatable: " + (cap.isPwcUpdatableSupported() ? "true" : "false"));
System.out.println("All versions searchable: "
+ (cap.isAllVersionsSearchableSupported() ? "true" : "false"));
System.out.println("\nQuery Capabilities");
System.out.println("-----------------------");
System.out.println("Query: " + cap.getQueryCapability().value());
System.out.println("Join: " + cap.getJoinCapability().value());
System.out.println("\nACL Capabilities");
System.out.println("-----------------------");
System.out.println("ACL: " + cap.getAclCapability().value());
System.out.println("End of repository capabilities");
System.out.println("\nAllowable actions...");
System.out.println("--------------------");
// find the current allowable actions for the test.txt document
System.out.println("Getting the current allowable actions for the " + doc.getName()
+ " document object...");
for (Action a : doc.getAllowableActions().getAllowableActions()) {
System.out.println("\t" + a.value());
}
// find out if we can currently check out test.txt
if (doc.getAllowableActions().getAllowableActions().contains(Action.CAN_CHECK_OUT)) {
System.out.println("can check out " + doc.getName());
} else {
System.out.println("can not check out " + doc.getName());
}
System.out.println("\nMultifiling and Unfiling...");
System.out.println("---------------------------");
// Try out multifiling if it is supported
System.out.println("Trying out multifiling");
Folder newFolder2 = null;
if (!(cap.isMultifilingSupported())) {
System.out.println("Multifiling not supported by this repository");
} else {
// Add a new folder to the root folder
System.out.println("Creating 'ADGNewFolder 2' in the root folder");
newFolderProps = new HashMap<String, String>();
newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
newFolderProps.put(PropertyIds.NAME, "ADGNewFolder 2");
newFolder2 = root.createFolder(newFolderProps, null, null, null,
session.getDefaultContext());
System.out.println("Adding " + textFileName + "to 'ADGNewFolder 2' in the root folder");
doc.addToFolder(newFolder2, true);
// Did it work?
children = newFolder.getChildren();
System.out.println("Now finding the following objects in the 'ADGNewFolder' folder:-");
for (CmisObject o : children) {
System.out.println(o.getName());
}
children = newFolder2.getChildren();
System.out
.println("Now finding the following objects in the 'ADGNewFolder 2' folder:-");
for (CmisObject o : children) {
System.out.println(o.getName());
}
}
// Try out unfiling if it is supported
System.out.println("Trying out unfiling");
if (!(cap.isUnfilingSupported())) {
System.out.println("Unfiling not supported by this repository");
} else {
// remove our document from both folders
System.out.println("removing :" + doc.getName() + "from 'ADGNewFolder':-");
doc.removeFromFolder(newFolder);