@Override
 public void streamNotSupported(
     DocumentTypeDefinition documentTypeDefinition, ContentStream contentStream) {
   if (documentTypeDefinition.getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED
       && contentStream != null) {
     String msg = "A Content stream must not be included";
     throw new CmisStreamNotSupportedException(msg, HTTP_STATUS_CODE_403);
   }
 }
 @Override
 public void constraintContentStreamRequired(
     DocumentTypeDefinition typeDefinition, ContentStream contentStream) {
   if (ContentStreamAllowed.REQUIRED.equals(typeDefinition.getContentStreamAllowed())) {
     if (contentStream == null || contentStream.getStream() == null) {
       constraint(
           "[typeId="
               + typeDefinition.getId()
               + "]This document type does not allow no content stream");
     }
   }
 }
 @Override
 public void constraintContentStreamRequired(String repositoryId, Document document) {
   String objectTypeId = document.getObjectType();
   DocumentTypeDefinition td =
       (DocumentTypeDefinition) typeManager.getTypeDefinition(repositoryId, objectTypeId);
   if (td.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
     if (document.getAttachmentNodeId() == null
         || contentService.getAttachment(repositoryId, document.getAttachmentNodeId()) == null) {
       constraint(document.getId(), "This document type does not allow no content stream");
     }
   }
 }
 @Override
 public void constraintContentStreamDownload(String repositoryId, Document document) {
   DocumentTypeDefinition documentTypeDefinition =
       (DocumentTypeDefinition) typeManager.getTypeDefinition(repositoryId, document);
   ContentStreamAllowed csa = documentTypeDefinition.getContentStreamAllowed();
   if (ContentStreamAllowed.NOTALLOWED == csa
       || ContentStreamAllowed.ALLOWED == csa
           && StringUtils.isBlank(document.getAttachmentNodeId())) {
     constraint(
         document.getId(),
         "This document has no ContentStream. getContentStream is not supported.");
   }
 }