public RepositoryInfo repositoryInfo() { RepositoryInfo repoInfo = null; Session session = this.getSession(this.connectionParameters); if (session != null) { repoInfo = session.getRepositoryInfo(); } return repoInfo; }
private CapabilityContentStreamUpdates getContentStreamUpdatesCapbility(Session session) { if (session.getRepositoryInfo().getCapabilities() == null) { return null; } return session.getRepositoryInfo().getCapabilities().getContentStreamUpdatesCapability(); }
protected boolean isOrderByNameSupported(Session session) { if (session.getRepositoryInfo().getCapabilities().getOrderByCapability() == CapabilityOrderBy.NONE) { return false; } return true; }
protected boolean isGetDescendantsSupported(Session session) { RepositoryCapabilities cap = session.getRepositoryInfo().getCapabilities(); if (cap == null) { return false; } if (cap.isGetDescendantsSupported() == null) { return false; } return cap.isGetDescendantsSupported().booleanValue(); }
protected boolean isGetFolderTreeSupported(Session session) { RepositoryCapabilities cap = session.getRepositoryInfo().getCapabilities(); if (cap == null) { return false; } if (cap.isGetFolderTreeSupported() == null) { return false; } return cap.isGetFolderTreeSupported().booleanValue(); }
protected boolean supportsUnfiling(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().isUnfilingSupported() == null) { return false; } return repository.getCapabilities().isUnfilingSupported().booleanValue(); } }
protected RepositoryInfo getRepositoryInfo(Session session) { RepositoryInfo ri = session.getRepositoryInfo(); CmisTestResult failure = createResult(FAILURE, "Repository info is null!", true); addResult(assertNotNull(ri, null, failure)); return ri; }
protected boolean supportsMultifiling(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().isMultifilingSupported() == null) { return false; } return repository.getCapabilities().isMultifilingSupported().booleanValue(); } }
protected boolean isFulltextOnly(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().getQueryCapability() == null) { return false; } return repository.getCapabilities().getQueryCapability() == CapabilityQuery.FULLTEXTONLY; } }
public void doExample() { // Get a CMIS session Session cmisSession = getCmisSession(); // Get the repository info RepositoryInfo repoInfo = cmisSession.getRepositoryInfo(); System.out.println("Product name: " + repoInfo.getProductName()); System.out.println("Product version: " + repoInfo.getProductVersion()); System.out.println("Product vendor: " + repoInfo.getVendorName()); System.out.println("CMIS version supported: " + repoInfo.getCmisVersionSupported()); RepositoryCapabilities caps = repoInfo.getCapabilities(); System.out.println("Partial list of capabilities..."); System.out.println("Joins? " + caps.getJoinCapability()); System.out.println("ACLs? " + caps.getAclCapability()); System.out.println("Changes? " + caps.getChangesCapability()); System.out.println("Queries? " + caps.getQueryCapability()); System.out.println("Content stream updates? " + caps.getContentStreamUpdatesCapability()); System.out.println("Renditions? " + caps.getRenditionsCapability()); System.out.println("Multifiling? " + caps.isMultifilingSupported()); System.out.println("Version-specific filing? " + caps.isVersionSpecificFilingSupported()); } }
protected CapabilityAcl getAclCapability(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().getAclCapability() == null) { return null; } return repository.getCapabilities().getAclCapability(); } }
protected boolean supportsContentChanges(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().getChangesCapability() == null) { return false; } return repository.getCapabilities().getChangesCapability() != CapabilityChanges.NONE; }
protected boolean supportsQuery(Session session) { RepositoryInfo repository = session.getRepositoryInfo(); if (repository.getCapabilities().getQueryCapability() == null) { return false; } return repository.getCapabilities().getQueryCapability() != CapabilityQuery.NONE; }
@Override public String getContentUrl() { if (session.getBinding().getObjectService() instanceof LinkAccess) { LinkAccess linkAccess = (LinkAccess) session.getBinding().getObjectService(); return linkAccess.loadRenditionContentLink(session.getRepositoryInfo().getId(), objectId, getStreamId()); } return null; } }
@Override public String getContentUrl() { if (session.getBinding().getObjectService() instanceof LinkAccess) { LinkAccess linkAccess = (LinkAccess) session.getBinding().getObjectService(); return linkAccess.loadRenditionContentLink(session.getRepositoryInfo().getId(), objectId, getStreamId()); } return null; } }
@Override public void run(Session session) { if (session.getRepositoryInfo().getCmisVersion() == CmisVersion.CMIS_1_0) { addResult(createResult(SKIPPED, "Type mutability is not supported by CMIS 1.0. Test skipped!")); return; } ObjectType parentType = session.getTypeDefinition(getDocumentTestTypeId()); if (parentType.getTypeMutability() == null || !Boolean.TRUE.equals(parentType.getTypeMutability().canCreate())) { addResult(createResult(SKIPPED, "Test document type doesn't allow creating a sub-type. Test skipped!")); return; } createTypeWithoutProperties(session, parentType); createTypeWithProperties(session, parentType); }
@Override public void reportFeedback(String feedbackId) { // Get the session, repository id and object service Session session = CmisSessionHelper.getSession(); String repoId = session.getRepositoryInfo().getId(); ObjectService objectService = session.getBinding().getObjectService(); // Create a comment flagged property with value true PropertiesImpl props = new PropertiesImpl(); props.addProperty(new PropertyBooleanImpl(PROP_COMMENT_FLAGGED, true)); // Update the comment flagged property in the repository objectService.updateProperties(repoId, new Holder<String>(feedbackId), null, props, null); }
/** * Translates CMIS repository information into Node. * * @return node document. */ private Document cmisRepository() { RepositoryInfo info = session.getRepositoryInfo(); DocumentWriter writer = newDocument(ObjectId.toString(ObjectId.Type.REPOSITORY_INFO, "")); writer.setPrimaryType(CmisLexicon.REPOSITORY); writer.setId(REPOSITORY_INFO_ID); // product name/vendor/version writer.addProperty(CmisLexicon.VENDOR_NAME, info.getVendorName()); writer.addProperty(CmisLexicon.PRODUCT_NAME, info.getProductName()); writer.addProperty(CmisLexicon.PRODUCT_VERSION, info.getProductVersion()); return writer.document(); }
@Override public ContentStream getContentStream() { if (objectId == null || getStreamId() == null) { return null; } ContentStream contentStream; try { contentStream = session.getBinding().getObjectService() .getContentStream(session.getRepositoryInfo().getId(), objectId, getStreamId(), null, null, null); } catch (CmisConstraintException e) { // no content stream return null; } if (contentStream == null) { return null; } String filename = contentStream.getFileName(); if (filename == null) { filename = getTitle(); } BigInteger bigLength = contentStream.getBigLength(); if (bigLength == null) { bigLength = getBigLength(); } long length = bigLength == null ? -1 : bigLength.longValue(); return session.getObjectFactory().createContentStream(filename, length, contentStream.getMimeType(), contentStream.getStream()); }
@Override public ContentStream getContentStream() { if (objectId == null || getStreamId() == null) { return null; } ContentStream contentStream; try { contentStream = session.getBinding().getObjectService() .getContentStream(session.getRepositoryInfo().getId(), objectId, getStreamId(), null, null, null); } catch (CmisConstraintException e) { // no content stream return null; } if (contentStream == null) { return null; } String filename = contentStream.getFileName(); if (filename == null) { filename = getTitle(); } BigInteger bigLength = contentStream.getBigLength(); if (bigLength == null) { bigLength = getBigLength(); } long length = bigLength == null ? -1 : bigLength.longValue(); return session.getObjectFactory().createContentStream(filename, length, contentStream.getMimeType(), contentStream.getStream()); }