@Override public InputStream execute(CommandContext commandContext) { if (contentItemId == null) { throw new FlowableIllegalArgumentException("contentItemId is null"); } ContentItem contentItem = CommandContextUtil.getContentItemEntityManager().findById(contentItemId); if (contentItem == null) { throw new FlowableObjectNotFoundException("content item could not be found with id " + contentItemId); } ContentStorage contentStorage = CommandContextUtil.getContentEngineConfiguration().getContentStorage(); ContentObject contentObject = contentStorage.getContentObject(contentItem.getContentStoreId()); return contentObject.getContent(); }
ContentObject createContentObject = contentStorage.createContentObject(inputStream, metaData); contentItemEntity.setContentStoreId(createContentObject.getId()); contentItemEntity.setContentStoreName(contentStorage.getContentStoreName()); contentItemEntity.setContentAvailable(true);
@Override public Void execute(CommandContext commandContext) { if (contentItemId == null) { throw new FlowableIllegalArgumentException("contentItemId is null"); } ContentItemEntity contentItem = (ContentItemEntity) CommandContextUtil.getContentItemEntityManager().findById(contentItemId); if (contentItem == null) { throw new FlowableObjectNotFoundException("content item could not be found with id " + contentItemId); } if (contentItem.getContentStoreId() != null) { ContentStorage contentStorage = CommandContextUtil.getContentEngineConfiguration().getContentStorage(); if (contentItem.isContentAvailable()) { contentStorage.deleteContentObject(contentItem.getContentStoreId()); } } CommandContextUtil.getContentItemEntityManager().delete(contentItem); return null; }