private RepositoryInfo createRepositoryInfo(String repositoryId) {
ObjectStore objStore = getObjectStore(repositoryId);
String rootFolderId = objStore.getRootFolder().getId();
// repository info
RepositoryInfoImpl repoInfo;
repoInfo = new RepositoryInfoImpl();
repoInfo.setId(repositoryId == null ? "inMem" : repositoryId);
repoInfo.setName("Apache Chemistry OpenCMIS InMemory Repository");
repoInfo.setDescription("Apache Chemistry OpenCMIS InMemory Repository (Version: " + OPENCMIS_VERSION + ")");
repoInfo.setCmisVersionSupported("1.0");
repoInfo.setRootFolder(rootFolderId);
repoInfo.setPrincipalAnonymous(InMemoryAce.getAnonymousUser());
repoInfo.setPrincipalAnyone(InMemoryAce.getAnyoneUser());
repoInfo.setThinClientUri("");
repoInfo.setChangesIncomplete(Boolean.TRUE);
repoInfo.setChangesOnType(null);
repoInfo.setLatestChangeLogToken(Long.valueOf(new Date(0).getTime()).toString());
repoInfo.setVendorName("Apache Chemistry");
repoInfo.setProductName("OpenCMIS InMemory-Server");
repoInfo.setProductVersion(OPENCMIS_VERSION);
// set capabilities
RepositoryCapabilitiesImpl caps = new RepositoryCapabilitiesImpl();
caps.setAllVersionsSearchable(false);
caps.setCapabilityAcl(CapabilityAcl.MANAGE);
caps.setCapabilityChanges(CapabilityChanges.NONE);
caps.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.ANYTIME);
caps.setCapabilityJoin(CapabilityJoin.NONE);
caps.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED);
caps.setCapabilityRendition(CapabilityRenditions.NONE);
caps.setIsPwcSearchable(false);
caps.setIsPwcUpdatable(true);
caps.setSupportsGetDescendants(true);
caps.setSupportsGetFolderTree(true);
caps.setSupportsMultifiling(true);
caps.setSupportsUnfiling(true);
caps.setSupportsVersionSpecificFiling(false);
caps.setCapabilityAcl(CapabilityAcl.MANAGE);
AclCapabilitiesDataImpl aclCaps = new AclCapabilitiesDataImpl();
aclCaps.setAclPropagation(AclPropagation.OBJECTONLY);
aclCaps.setSupportedPermissions(SupportedPermissions.BASIC);
// permissions
List<PermissionDefinition> permissions = new ArrayList<PermissionDefinition>();
permissions.add(createPermission(CMIS_READ, "Read"));
permissions.add(createPermission(CMIS_WRITE, "Write"));
permissions.add(createPermission(CMIS_ALL, "All"));
aclCaps.setPermissionDefinitionData(permissions);
// mapping
List<PermissionMapping> list = new ArrayList<PermissionMapping>();
list.add(createMapping(PermissionMapping.CAN_GET_DESCENDENTS_FOLDER, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_CHILDREN_FOLDER, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_PARENTS_FOLDER, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_FOLDER_PARENT_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_CREATE_DOCUMENT_FOLDER, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_CREATE_FOLDER_FOLDER, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_CREATE_RELATIONSHIP_SOURCE, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_CREATE_RELATIONSHIP_TARGET, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_PROPERTIES_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_VIEW_CONTENT_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_UPDATE_PROPERTIES_OBJECT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_MOVE_OBJECT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_MOVE_TARGET, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_MOVE_SOURCE, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_DELETE_OBJECT, CMIS_WRITE));
;
list.add(createMapping(PermissionMapping.CAN_DELETE_TREE_FOLDER, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_SET_CONTENT_DOCUMENT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_DELETE_CONTENT_DOCUMENT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_ADD_TO_FOLDER_OBJECT, CMIS_WRITE));
;
list.add(createMapping(PermissionMapping.CAN_ADD_TO_FOLDER_FOLDER, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_REMOVE_FROM_FOLDER_OBJECT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_REMOVE_FROM_FOLDER_FOLDER, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_CHECKOUT_DOCUMENT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_CANCEL_CHECKOUT_DOCUMENT, CMIS_WRITE));
;
list.add(createMapping(PermissionMapping.CAN_CHECKIN_DOCUMENT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_GET_ALL_VERSIONS_VERSION_SERIES, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_OBJECT_RELATIONSHIPS_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_ADD_POLICY_OBJECT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_ADD_POLICY_POLICY, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_REMOVE_POLICY_OBJECT, CMIS_WRITE));
list.add(createMapping(PermissionMapping.CAN_REMOVE_POLICY_POLICY, CMIS_WRITE));
;
list.add(createMapping(PermissionMapping.CAN_GET_APPLIED_POLICIES_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_GET_ACL_OBJECT, CMIS_READ));
list.add(createMapping(PermissionMapping.CAN_APPLY_ACL_OBJECT, CMIS_ALL));
Map<String, PermissionMapping> map = new LinkedHashMap<String, PermissionMapping>();
for (PermissionMapping pm : list) {
map.put(pm.getKey(), pm);
}
aclCaps.setPermissionMappingData(map);
repoInfo.setAclCapabilities(aclCaps);
repoInfo.setCapabilities(caps);
fRepositoryInfo = repoInfo;
return repoInfo;
}