Class DocumentScriptingWrapper
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Object>
-
- org.nuxeo.automation.scripting.internals.DocumentScriptingWrapper
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Object>
public class DocumentScriptingWrapper extends HashMap<String,Object>
Wrap aDocumentModel
to expose in a pretty way more information to automation scripts.- Since:
- 8.4
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected DocumentModel
doc
protected AutomationMapper
mapper
-
Constructor Summary
Constructors Constructor Description DocumentScriptingWrapper(AutomationMapper mapper, DocumentModel doc)
-
Method Summary
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
-
-
-
Field Detail
-
mapper
protected final AutomationMapper mapper
-
doc
protected final DocumentModel doc
-
-
Constructor Detail
-
DocumentScriptingWrapper
public DocumentScriptingWrapper(AutomationMapper mapper, DocumentModel doc)
-
-
Method Detail
-
wrap
public static Object wrap(Object object, AutomationMapper mapper)
-
computeProperties
protected static Properties computeProperties(Map<?,?> result)
-
getDoc
public DocumentModel getDoc()
-
getSession
public CoreSession getSession()
-
getParent
public DocumentScriptingWrapper getParent()
-
getParent
public DocumentScriptingWrapper getParent(String type)
-
getWorkspace
public DocumentScriptingWrapper getWorkspace()
-
getDomain
public DocumentScriptingWrapper getDomain()
-
getTitle
public String getTitle()
-
getPath
public String getPath()
-
getRef
public DocumentRef getRef()
- Returns:
- the document ref
-
resolvePathAsRef
public DocumentRef resolvePathAsRef(String relative)
-
getDescription
public String getDescription()
-
hasFacet
public boolean hasFacet(String facet)
-
hasSchema
public boolean hasSchema(String schema)
-
addFacet
public boolean addFacet(String facet)
-
removeFacet
public boolean removeFacet(String facet)
-
getType
public String getType()
-
getDocumentType
public DocumentType getDocumentType()
-
getLifeCycle
public String getLifeCycle()
-
isLocked
public boolean isLocked()
-
isFolder
public boolean isFolder()
-
isImmutable
public boolean isImmutable()
-
isProxy
public boolean isProxy()
-
isVersion
public boolean isVersion()
-
isDownloadable
public boolean isDownloadable()
-
isVersionable
public boolean isVersionable()
-
getId
public String getId()
-
getName
public String getName()
-
getSchemas
public String[] getSchemas()
-
getProperty
public Serializable getProperty(String key)
-
getPropertyValue
public Serializable getPropertyValue(String key)
Alias for #getProperty.
-
setProperty
public void setProperty(String key, Serializable value)
-
setPropertyValue
public void setPropertyValue(String key, Serializable value)
Alias for #setProperty.
-
setPropertyValue
public void setPropertyValue(String key, ScriptObjectMirror value)
Used by nashorn for native javascript array/date.
-
getVersionLabel
public String getVersionLabel()
-
containsKey
public boolean containsKey(Object key)
property map implementation- Specified by:
containsKey
in interfaceMap<String,Object>
- Overrides:
containsKey
in classHashMap<String,Object>
-
containsValue
public boolean containsValue(Object value)
The behavior of this method was changed -> it is checking if an xpath has a value attached.- Specified by:
containsValue
in interfaceMap<String,Object>
- Overrides:
containsValue
in classHashMap<String,Object>
-
get
public Serializable get(Object key)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
values
public Collection<Object> values()
-
put
public Object put(String key, Object value)
As we need to handleScriptObjectMirror
for array type from nashorn.
-
put
public Serializable put(String key, Serializable value)
-
remove
public Serializable remove(Object key)
-
clear
public void clear()
-
toString
public String toString()
- Overrides:
toString
in classAbstractMap<String,Object>
-
-