@Override public PageAttachmentReference replaceParent(EntityReference oldParent, EntityReference newParent) { if (newParent == oldParent) { return this; } return new PageAttachmentReference(this, oldParent, newParent); }
@Override public PageAttachmentReference resolve(String attachmentReferenceRepresentation, Object... parameters) { return new PageAttachmentReference(this.entityReferenceResolver.resolve(attachmentReferenceRepresentation, EntityType.PAGE_ATTACHMENT, parameters)); } }
@Override public PageAttachmentReference replaceParent(EntityReference newParent) { if (newParent == getParent()) { return this; } return new PageAttachmentReference(this, newParent); } }
@Override public PageAttachmentReference resolve(String attachmentReferenceRepresentation, Object... parameters) { return new PageAttachmentReference(this.entityReferenceResolver.resolve(attachmentReferenceRepresentation, EntityType.PAGE_ATTACHMENT, parameters)); } }
@Override public PageAttachmentReference resolve(EntityReference attachmentReferenceRepresentation, Object... parameters) { if (attachmentReferenceRepresentation instanceof PageAttachmentReference) { return (PageAttachmentReference) attachmentReferenceRepresentation; } return new PageAttachmentReference(this.entityReferenceResolver.resolve(attachmentReferenceRepresentation, EntityType.PAGE_ATTACHMENT, parameters)); } }
/** * Creates a {@link PageAttachmentReference} from a file name and a reference to the page holding that file. * * @param pageReference a reference to the page the file is attached to * @param fileName the name of a file attached to a page * @return a reference to the specified attachment * @since 10.6RC1 */ @Unstable public PageAttachmentReference createPageAttachmentReference(PageReference pageReference, String fileName) { return new PageAttachmentReference(fileName, pageReference); }
/** * @param stringRepresentation an attachment reference specified as {@link String} (using the "wiki:space/page/file" * format and with special characters escaped where required) * @param hint the hint of the resolver to use in case any part of the reference is missing (no wiki specified, no * space or no page) * @param parameters extra parameters to pass to the resolver; you can use these parameters to resolve an attachment * reference relative to another entity reference * @return the corresponding typed {@link PageAttachmentReference} object * @since 10.6RC1 */ @Unstable public PageAttachmentReference resolvePageAttachment(String stringRepresentation, String hint, Object... parameters) { try { EntityReferenceResolver<String> resolver = this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); return new PageAttachmentReference( resolver.resolve(stringRepresentation, EntityType.PAGE_ATTACHMENT, parameters)); } catch (ComponentLookupException e) { return null; } }