@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; }