@Override public void deleteContentStream( CallContext callContext, String repositoryId, Holder<String> objectId, Holder<String> changeToken, ExtensionsData extension) { exceptionService.invalidArgumentRequiredHolderString("objectId", objectId); Lock lock = threadLockService.getWriteLock(repositoryId, objectId.getValue()); try { lock.lock(); // ////////////////// // Exception // ////////////////// Document document = contentService.getDocument(repositoryId, objectId.getValue()); exceptionService.objectNotFound(DomainType.OBJECT, document, document.getId()); exceptionService.constraintContentStreamRequired(repositoryId, document); // ////////////////// // Body of the method // ////////////////// contentService.deleteContentStream(callContext, repositoryId, objectId); nemakiCachePool.get(repositoryId).removeCmisCache(objectId.getValue()); } finally { lock.unlock(); } }
@Override public String createDocumentFromSource( CallContext callContext, String repositoryId, String sourceId, Properties properties, String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces) { Document original = contentService.getDocument(repositoryId, sourceId); DocumentTypeDefinition td = (DocumentTypeDefinition) typeManager.getTypeDefinition(repositoryId, original.getObjectType()); // ////////////////// // General Exception // ////////////////// exceptionService.invalidArgumentRequired("properties", properties); exceptionService.invalidArgumentRequiredParentFolderId(repositoryId, folderId); Folder parentFolder = contentService.getFolder(repositoryId, folderId); exceptionService.objectNotFoundParentFolder(repositoryId, folderId, parentFolder); exceptionService.permissionDenied( callContext, repositoryId, PermissionMapping.CAN_CREATE_FOLDER_FOLDER, parentFolder); // ////////////////// // Specific Exception // ////////////////// exceptionService.constraintBaseTypeId(repositoryId, properties, BaseTypeId.CMIS_DOCUMENT); exceptionService.constraintAllowedChildObjectTypeId(parentFolder, properties); exceptionService.constraintPropertyValue( repositoryId, td, properties, DataUtil.getIdProperty(properties, PropertyIds.OBJECT_ID)); exceptionService.constraintControllableVersionable(td, versioningState, null); versioningState = (td.isVersionable() && versioningState == null) ? VersioningState.MAJOR : versioningState; exceptionService.constraintCotrollablePolicies(td, policies, properties); exceptionService.constraintCotrollableAcl(td, addAces, removeAces, properties); exceptionService.constraintPermissionDefined(repositoryId, addAces, null); exceptionService.constraintPermissionDefined(repositoryId, removeAces, null); exceptionService.nameConstraintViolation(properties, parentFolder); // ////////////////// // Body of the method // ////////////////// Document document = contentService.createDocumentFromSource( callContext, repositoryId, properties, parentFolder, original, versioningState, policies, addAces, removeAces); return document.getId(); }