private Content move( final ContentId sourceId, final ContentPath newPath ) { final MoveContentParams moveParams = MoveContentParams.create(). contentId( sourceId ). parentContentPath( newPath ). build(); final MoveContentsResult result = contentService.move( moveParams ); return contentService.getById( result.getMovedContents().first() ); }
private Content rename( final ContentId sourceId, final String newName ) { final ContentName newContentName = ContentName.from( newName ); final RenameContentParams renameParams = RenameContentParams.create().contentId( sourceId ).newName( newContentName ).build(); return contentService.rename( renameParams ); }
public CreateContentTranslatorParams build() { this.validate(); return new CreateContentTranslatorParams( this ); } }
private boolean contentExists( final String contentSelector ) { final ContentId contentId = ContentId.from( contentSelector.substring( 1 ) ); final ContentPath contentPath = ContentPath.from( contentSelector ).asAbsolute(); return this.contentService.contentExists( contentId ) || this.contentService.contentExists( contentPath ); }
private CreateMediaParams createParams( final String name ) { final CreateMediaParams params = new CreateMediaParams(); params.name( name ); params.parent( this.parentPath != null ? ContentPath.from( this.parentPath ) : null ); params.mimeType( this.mimeType ); params.byteSource( this.data ); params.focalX( this.focalX ); params.focalY( this.focalY ); return params; }
private ContentsResultMapper convert( final FindContentIdsByQueryResult findQueryResult ) { final ContentIds contentIds = findQueryResult.getContentIds(); final Contents contents; if ( contentIds.isEmpty() ) { contents = Contents.empty(); } else { contents = this.contentService.getByIds( new GetContentByIdsParams( contentIds ) ); } return new ContentsResultMapper( contents, findQueryResult.getTotalHits(), findQueryResult.getAggregations() ); }
public static ContentPath from( final ContentPath parent, final ContentPath relative ) { final Builder builder = create().elements( parent.elements ); builder.addElements( relative.elements ); builder.absolute( parent.isAbsolute() ); return builder.build(); }
public static ContentPath from( final ContentPath parent, final String name ) { return create().elements( parent.elements ).absolute( parent.isAbsolute() ).addElement( name ).build(); }
protected final Site getSiteOrNull( final Content content ) { return content != null ? this.contentService.getNearestSite( content.getId() ) : null; }
public ContentPath asRelative() { if ( isRelative() ) { return this; } return new ContentPath.Builder( this ).absolute( false ).build(); }
public ContentPath asAbsolute() { if ( isAbsolute() ) { return this; } return new ContentPath.Builder( this ).absolute( true ).build(); }
public UpdateContentTranslatorParams build() { validate(); return new UpdateContentTranslatorParams( this ); } }
public UnpublishContentParams build() { this.validate(); return new UnpublishContentParams( this ); } }
public CreateContentParams build() { this.validate(); return new CreateContentParams( this ); } }
public ContentIds build() { return ContentIds.from( contents ); } }