public void execute() { UpdateContentParams updateContent = new UpdateContentParams(); if ( !this.key.startsWith( "/" ) ) { updateContent.contentId( ContentId.from( this.key ) ); } else { final Content contentByPath = this.contentService.getByPath( ContentPath.from( key ) ); updateContent.contentId( contentByPath.getId() ); } BinaryReferences binaryRefs = BinaryReferences.from( Arrays.stream( this.names ).map( BinaryReference::from ).collect( toList() ) ); updateContent.removeAttachments( binaryRefs ); contentService.update( updateContent ); }
@Override protected Object doExecute() { final Content existingContent = getExistingContent( this.key ); if ( existingContent == null ) { return null; } final UpdateContentParams params = new UpdateContentParams(); params.contentId( existingContent.getId() ); params.editor( newContentEditor( existingContent ) ); params.requireValid( this.requireValid ); final Content result = this.contentService.update( params ); return result != null ? new ContentMapper( result ) : null; }
public void execute() { UpdateContentParams updateContent = new UpdateContentParams(); if ( !this.key.startsWith( "/" ) ) { updateContent.contentId( ContentId.from( this.key ) ); } else { final Content contentByPath = this.contentService.getByPath( ContentPath.from( key ) ); updateContent.contentId( contentByPath.getId() ); } final CreateAttachment createAttachment = CreateAttachment.create(). name( this.name ). label( this.label ). mimeType( this.mimeType ). byteSource( getData() ). build(); updateContent.createAttachments( CreateAttachments.from( createAttachment ) ); contentService.update( updateContent ); }
edit.permissions = permissions; } ); contentService.update( updatePermissionsParams );