@Override public ContentId apply( final String value ) { return ContentId.from( value ); } }
@Override public String toString() { return this.id.toString(); }
public static ContentId from( final String id ) { Preconditions.checkNotNull( id, "ContentId cannot be null" ); Preconditions.checkArgument( !id.trim().isEmpty(), "ContentId cannot be blank" ); return new ContentId( id ); }
@Override public boolean equals( final Object o ) { return ( o instanceof PageTemplateKey ) && ( (PageTemplateKey) o ).id.equals( this.id ); }
@Override public int hashCode() { return contentId.hashCode(); }
@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof DuplicateContentParams ) ) { return false; } final DuplicateContentParams that = (DuplicateContentParams) o; if ( !contentId.equals( that.contentId ) ) { return false; } if ( !includeChildren.equals( that.includeChildren ) ) { return false; } return true; }
@Override public int hashCode() { return this.id.hashCode(); }
private static ContentId convertToContentId( final Object value ) { if ( value instanceof ContentId ) { return (ContentId) value; } else if ( value instanceof String ) { return ContentId.from( (String) value ); } else { return null; } }
public ContentNotFoundException( final ContentId contentId, final Branch branch ) { super( MessageFormat.format( "Content with id [{0}] was not found in branch [{1}]", contentId.toString(), branch ) ); this.path = path; }
@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof HasUnpublishedChildrenParams ) ) { return false; } final HasUnpublishedChildrenParams that = (HasUnpublishedChildrenParams) o; if ( !contentId.equals( that.contentId ) ) { return false; } if( !target.equals( that.target )) { return false; } return true; }
@Override public int hashCode() { int result = contentId != null ? contentId.hashCode() : 0; result = 31 * result + ( parentContentPath != null ? parentContentPath.hashCode() : 0 ); return result; }
public static ContentId from( final Reference reference ) { return new ContentId( reference.getNodeId().toString() ); } }
@Override public ContentId convert( final Object value ) { if ( value instanceof ContentId ) { return (ContentId) value; } return ContentId.from( value.toString() ); } }
public PageNotFoundException( final ContentId contentId ) { super( MessageFormat.format( "Content with id [{0}] is not a page", contentId.toString() ) ); } }
@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof MoveContentParams ) ) { return false; } final MoveContentParams that = (MoveContentParams) o; if ( !contentId.equals( that.contentId ) ) { return false; } else if ( !parentContentPath.equals( that.parentContentPath ) ) { return false; } return true; }
public static PageTemplateKey from( final String value ) { return from( ContentId.from( CharacterChecker.check( value, "Not a valid value for PageTemplateKey [" + value + "]" ) ) ); }
private void serializeContentIds( final MapGenerator gen, final String name, final ContentIds contents ) { gen.array( name ); for ( ContentId id : contents ) { gen.value( id.toString() ); } gen.end(); }
@Override protected Object doExecute() { if ( this.key == null || this.key.isEmpty() ) { throw new IllegalArgumentException( "Parameter 'key' is required" ); } if ( this.key.startsWith( "/" ) ) { return getByPath( ContentPath.from( this.key ) ); } else { return getById( ContentId.from( this.key ) ); } }
private void serializeFailedContent( final MapGenerator gen, final String name, final ContentIds contents ) { gen.array( name ); for ( ContentId id : contents ) { gen.value( id.toString() ); } for ( ContentPath path : this.contentNotFound ) { gen.value( path.toString() ); } gen.end(); } }
@Override protected Object doExecute() { if ( this.key == null || this.key.isEmpty() ) { throw new IllegalArgumentException( "Parameter 'key' is required" ); } if ( this.key.startsWith( "/" ) ) { return getByPath( ContentPath.from( this.key ) ); } else { return getById( ContentId.from( this.key ) ); } }