@Component @Named(value="model") @Singleton public class ModelScriptService extends Object implements org.xwiki.script.service.ScriptService
| Constructor and Description |
|---|
ModelScriptService() |
| Modifier and Type | Method and Description |
|---|---|
AttachmentReference |
createAttachmentReference(DocumentReference documentReference,
String fileName)
Creates an
AttachmentReference from a file name and a reference to the document holding that file. |
DocumentReference |
createDocumentReference(DocumentReference reference,
Locale locale)
Create a new reference with the passed
Locale. |
DocumentReference |
createDocumentReference(String wiki,
String space,
String page)
Create a Document Reference from a passed wiki, space and page names, which can be empty strings or
null
in which case they are resolved using the resolver. |
DocumentReference |
createDocumentReference(String wiki,
String space,
String page,
String hint)
Create a Document Reference from a passed wiki, space and page names, which can be empty strings or null in which
case they are resolved against the Resolver having the hint passed as parameter.
|
EntityReference |
createEntityReference(String name,
EntityType type)
Creates any
EntityReference from a string. |
EntityReference |
createEntityReference(String name,
EntityType type,
EntityReference parent)
Creates any
EntityReference from a string. |
SpaceReference |
createSpaceReference(String spaceName,
WikiReference parent)
Creates a
SpaceReference from a string representing the space name. |
WikiReference |
createWikiReference(String wikiName)
Creates a
WikiReference from a string representing the wiki name. |
String |
getEntityReferenceValue(EntityType type)
Get the current value for a specific entity type, like the current space or wiki name.
|
String |
getEntityReferenceValue(EntityType type,
String hint)
Get the value configured for a specific entity type, like the space name or wiki name.
|
AttachmentReference |
resolveAttachment(String stringRepresentation,
Object... parameters) |
AttachmentReference |
resolveAttachment(String stringRepresentation,
String hint,
Object... parameters) |
ClassPropertyReference |
resolveClassProperty(String stringRepresentation,
Object... parameters) |
ClassPropertyReference |
resolveClassProperty(String stringRepresentation,
String hint,
Object... parameters) |
DocumentReference |
resolveDocument(String stringRepresentation,
Object... parameters) |
DocumentReference |
resolveDocument(String stringRepresentation,
String hint,
Object... parameters) |
ObjectReference |
resolveObject(String stringRepresentation,
Object... parameters) |
ObjectReference |
resolveObject(String stringRepresentation,
String hint,
Object... parameters) |
ObjectPropertyReference |
resolveObjectProperty(String stringRepresentation,
Object... parameters) |
ObjectPropertyReference |
resolveObjectProperty(String stringRepresentation,
String hint,
Object... parameters) |
SpaceReference |
resolveSpace(String stringRepresentation,
Object... parameters) |
SpaceReference |
resolveSpace(String stringRepresentation,
String hint,
Object... parameters) |
String |
serialize(EntityReference reference,
Object... parameters) |
String |
serialize(EntityReference reference,
String hint,
Object... parameters) |
EntityReferenceTree |
toTree(EntityReference... references)
Convert passed references to a tree of references.
|
EntityReferenceTree |
toTree(Iterable<? extends EntityReference> references)
Convert passed references to a tree of references.
|
public DocumentReference createDocumentReference(String wiki, String space, String page)
null
in which case they are resolved using the resolver.wiki - the wiki reference name to use (can be empty or null)space - the space reference name to use (can be empty or null)page - the page reference name to use (can be empty or null)public DocumentReference createDocumentReference(DocumentReference reference, Locale locale)
Locale.reference - the reference (with or without locale)locale - the locale of the new referencepublic DocumentReference createDocumentReference(String wiki, String space, String page, String hint)
wiki - the wiki reference name to use (can be empty or null)space - the space reference name to use (can be empty or null)page - the page reference name to use (can be empty or null)hint - the hint of the Resolver to use in case any parameter is empty or nullpublic AttachmentReference createAttachmentReference(DocumentReference documentReference, String fileName)
AttachmentReference from a file name and a reference to the document holding that file.documentReference - a reference to the document the file is attached tofileName - the name of a file attached to a document@Unstable public WikiReference createWikiReference(String wikiName)
WikiReference from a string representing the wiki name.wikiName - the wiki name (eg "xwiki")@Unstable public SpaceReference createSpaceReference(String spaceName, WikiReference parent)
SpaceReference from a string representing the space name.spaceName - the space name (eg "Main")parent - the wiki reference in which the space is located@Unstable public EntityReference createEntityReference(String name, EntityType type)
EntityReference from a string.name - the entity reference name (eg "page")type - the entity type (eg "wiki", "space", "document", etc)@Unstable public EntityReference createEntityReference(String name, EntityType type, EntityReference parent)
EntityReference from a string.name - the entity reference name (eg "page")type - the entity type (eg "wiki", "space", "document", etc)parent - the entity parent@Unstable public SpaceReference resolveSpace(String stringRepresentation, Object... parameters)
stringRepresentation - the space reference specified as a String (using the "wiki:space" format and with
special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a space
reference relative to another entity reference@Unstable public SpaceReference resolveSpace(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - the space reference specified as a String (using the "wiki:space" format and with
special characters escaped where required)hint - the hint of the Resolver to use in case any part of the reference is missing (no wiki or no space
specified)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a space
reference relative to another entity referencepublic DocumentReference resolveDocument(String stringRepresentation, Object... parameters)
stringRepresentation - the document reference specified as a String (using the "wiki:space.page" format and
with special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a document
reference relative to another entity referencepublic DocumentReference resolveDocument(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - the document reference specified as a String (using the "wiki:space.page" format and
with special characters escaped where required)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)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a document
reference relative to another entity referencepublic AttachmentReference resolveAttachment(String stringRepresentation, Object... parameters)
stringRepresentation - an attachment reference specified as String (using the "wiki:space.page@file"
format and with special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an attachment
reference relative to another entity referenceAttachmentReference object (resolved using the
resolver)public AttachmentReference resolveAttachment(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - an attachment reference specified as String (using the "wiki:space.page@file"
format and with special characters escaped where required)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)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an attachment
reference relative to another entity referenceAttachmentReference objectpublic ObjectReference resolveObject(String stringRepresentation, Object... parameters)
stringRepresentation - an object reference specified as String (using the "wiki:space.page^object"
format and with special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an object
reference relative to another entity referenceObjectReference object (resolved using the
resolver)public ObjectReference resolveObject(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - an object reference specified as String (using the "wiki:space.page^object"
format and with special characters escaped where required)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)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an object
reference relative to another entity referenceObjectReference objectpublic ObjectPropertyReference resolveObjectProperty(String stringRepresentation, Object... parameters)
stringRepresentation - an object property reference specified as String (using the
"wiki:space.page^object.property" format and with special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an object
property reference relative to another entity referenceObjectPropertyReference object (resolved using the
resolver)public ObjectPropertyReference resolveObjectProperty(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - an object property reference specified as String (using the
"wiki:space.page^object.property" format and with special characters escaped where required)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)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve an object
property reference relative to another entity referenceObjectPropertyReference objectpublic ClassPropertyReference resolveClassProperty(String stringRepresentation, Object... parameters)
stringRepresentation - a class property reference specified as String (using the
"wiki:Space.Class^property" format and with special characters escaped where required)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a class
property reference relative to another entity referenceClassPropertyReference object (resolved using the
resolver)public ClassPropertyReference resolveClassProperty(String stringRepresentation, String hint, Object... parameters)
stringRepresentation - a class property reference specified as String (using the
"wiki:Space.Class^property" format and with special characters escaped where required)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)parameters - extra parameters to pass to the resolver; you can use these parameters to resolve a class
property reference relative to another entity referenceClassPropertyReference objectpublic String serialize(EntityReference reference, Object... parameters)
reference - the entity reference to transform into a String representationparameters - the optional extra parameters to pass to the Serializer; they are passed directly to
EntityReferenceSerializer.serialize(org.xwiki.model.reference.EntityReference, Object...)public String serialize(EntityReference reference, String hint, Object... parameters)
reference - the entity reference to transform into a String representationhint - the hint of the Serializer to use (valid hints are for example "default", "compact", "local")parameters - the optional extra parameters to pass to the Serializer; they are passed directly to
EntityReferenceSerializer.serialize(org.xwiki.model.reference.EntityReference, Object...)public String getEntityReferenceValue(EntityType type)
type - the target entity type; from Velocity it's enough to use a string with the uppercase name of the
entity, like 'SPACE'public String getEntityReferenceValue(EntityType type, String hint)
type - the target entity type; from Velocity it's enough to use a string with the uppercase name of the
entity, like 'SPACE'hint - the hint of the value provider to use (valid hints are for example "default", "current" and
"currentmixed")@Unstable public EntityReferenceTree toTree(Iterable<? extends EntityReference> references)
references - the references@Unstable public EntityReferenceTree toTree(EntityReference... references)
references - the referencesCopyright © 2004–2014 XWiki. All rights reserved.