|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.model.script.ModelScriptService
@Component @Named(value="model") @Singleton public class ModelScriptService
Provides Model-specific Scripting APIs.
| Constructor Summary | |
|---|---|
ModelScriptService()
|
|
| Method Summary | |
|---|---|
AttachmentReference |
createAttachmentReference(DocumentReference documentReference,
String fileName)
Creates an AttachmentReference from a file name and a reference to the document holding that file. |
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)
|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModelScriptService()
| Method Detail |
|---|
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(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 null
public 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 reference
public 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 reference
public 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 reference
public 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 reference
AttachmentReference 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 reference
AttachmentReference object
public 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 reference
ObjectReference 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 reference
ObjectReference object
public 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 reference
ObjectReference 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 reference
ObjectReference object
public 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")
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||