public ContentItemResponse createContentItemResponse(ContentItem contentItem, ContentRestUrlBuilder urlBuilder) { ContentItemResponse response = new ContentItemResponse(contentItem, urlBuilder.buildUrl(ContentRestUrls.URL_CONTENT_ITEM, contentItem.getId())); return response; }
public void deleteContent(String contentId, HttpServletResponse response) { ContentItem contentItem = contentService.createContentItemQuery().id(contentId).singleResult(); if (contentItem == null) { throw new NotFoundException("No content found with id: " + contentId); } if (!permissionService.hasWritePermissionOnRelatedContent(SecurityUtils.getCurrentUserObject(), contentItem)) { throw new NotPermittedException("You are not allowed to delete the content with id: " + contentId); } if (contentItem.getField() != null) { // Not allowed to delete content that has been added as part of a form throw new NotPermittedException("You are not allowed to delete the content with id: " + contentId); } contentService.deleteContentItem(contentItem.getId()); }
if (contentItem.getId() == null) { if (contentItemEntity.getCreated() == null) { contentItemEntity.setCreated(contentEngineConfiguration.getClock().getCurrentTime());
public ContentItemResponse(ContentItem contentItem, String url) { setId(contentItem.getId()); setName(contentItem.getName()); setMimeType(contentItem.getMimeType()); setTaskId(contentItem.getTaskId()); setProcessInstanceId(contentItem.getProcessInstanceId()); setContentStoreId(contentItem.getContentStoreId()); setContentStoreName(contentItem.getContentStoreName()); setContentAvailable(contentItem.isContentAvailable()); setTenantId(contentItem.getTenantId()); setCreated(contentItem.getCreated()); setCreatedBy(contentItem.getCreatedBy()); setLastModified(contentItem.getLastModified()); setLastModifiedBy(contentItem.getLastModifiedBy()); setUrl(url); }