Package org.nuxeo.ecm.core.storage.sql
Class Node
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.Node
-
- All Implemented Interfaces:
StateAccessor
public class Node extends Object implements StateAccessor
ANode
implementation. The actual data is stored in contained objects that areFragment
s.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.nuxeo.ecm.core.storage.sql.FragmentsMap
fragments
Fragment information for each additional mixin or inherited fragment.protected SimpleFragment
hierFragment
The hierarchy/main fragment.protected String
path
Path, only for immediate consumption after construction (will be reset to null afterwards).
-
Constructor Summary
Constructors Modifier Constructor Description protected
Node(PersistenceContext context, org.nuxeo.ecm.core.storage.sql.FragmentGroup fragmentGroup, String path)
Creates a Node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clearCache()
Clears the properties cache, used when removing mixins.boolean
equals(Object other)
Set<String>
getAllMixinTypes()
Gets the mixins.Object[]
getArray(String name)
Gets an array value.CollectionProperty
getCollectionProperty(String name)
Gets a collection property from the node, given its name.protected SimpleFragment
getHierFragment()
Serializable
getId()
Gets the node unique id, usually a Long or a String.String[]
getMixinTypes()
Gets the instance mixins.String
getName()
Serializable
getParentId()
String
getPath()
Gets the path that was assigned atNode
construction time.Long
getPos()
String
getPrimaryType()
protected ModelProperty
getPropertyInfo(String name)
SimpleProperty
getSimpleProperty(String name)
Gets a simple property from the node, given its name.Object
getSingle(String name)
Gets a single value.int
hashCode()
boolean
hasMixinType(String mixin)
Checks the mixins.boolean
isProxy()
boolean
isRecord()
boolean
isVersion()
protected CollectionProperty
makeCollectionProperty(String name, ModelProperty propertyInfo)
protected SimpleProperty
makeSimpleProperty(String name, ModelProperty propertyInfo)
void
setArray(String name, Object[] value)
Sets an array value.void
setCollectionProperty(String name, Object[] value)
void
setSimpleProperty(String name, Object value)
void
setSingle(String name, Object value)
Sets a single value.String
toString()
-
-
-
Field Detail
-
hierFragment
protected final SimpleFragment hierFragment
The hierarchy/main fragment.
-
fragments
protected final org.nuxeo.ecm.core.storage.sql.FragmentsMap fragments
Fragment information for each additional mixin or inherited fragment.
-
-
Constructor Detail
-
Node
protected Node(PersistenceContext context, org.nuxeo.ecm.core.storage.sql.FragmentGroup fragmentGroup, String path)
Creates a Node.- Parameters:
context
- the persistence contextfragmentGroup
- the group of fragments for the nodepath
- the path, if known at construction time
-
-
Method Detail
-
getId
public Serializable getId()
Gets the node unique id, usually a Long or a String.- Returns:
- the node id
-
getPrimaryType
public String getPrimaryType()
-
getParentId
public Serializable getParentId()
-
getPath
public String getPath()
Gets the path that was assigned atNode
construction time. Then it's reset tonull
. Should only be used once.- Returns:
- the path, or
null
for unknown
-
getHierFragment
protected SimpleFragment getHierFragment()
-
isVersion
public boolean isVersion()
-
isProxy
public boolean isProxy()
-
isRecord
public boolean isRecord()
-
getMixinTypes
public String[] getMixinTypes()
Gets the instance mixins. Mixins from the type are not returned.Never returns
null
.
-
getAllMixinTypes
public Set<String> getAllMixinTypes()
Gets the mixins. Includes mixins from the type. Returns a fresh set.
-
hasMixinType
public boolean hasMixinType(String mixin)
Checks the mixins. Includes mixins from the type.
-
clearCache
protected void clearCache()
Clears the properties cache, used when removing mixins.
-
getSimpleProperty
public SimpleProperty getSimpleProperty(String name)
Gets a simple property from the node, given its name.- Parameters:
name
- the property name- Returns:
- the property
- Throws:
PropertyNotFoundException
- if the name is invalid
-
makeSimpleProperty
protected SimpleProperty makeSimpleProperty(String name, ModelProperty propertyInfo)
-
getCollectionProperty
public CollectionProperty getCollectionProperty(String name)
Gets a collection property from the node, given its name.- Parameters:
name
- the property name- Returns:
- the property
- Throws:
PropertyNotFoundException
- if the name is invalid
-
makeCollectionProperty
protected CollectionProperty makeCollectionProperty(String name, ModelProperty propertyInfo)
-
getPropertyInfo
protected ModelProperty getPropertyInfo(String name)
-
setSimpleProperty
public void setSimpleProperty(String name, Object value)
-
setCollectionProperty
public void setCollectionProperty(String name, Object[] value)
-
getSingle
public Object getSingle(String name) throws PropertyException
Description copied from interface:StateAccessor
Gets a single value.- Specified by:
getSingle
in interfaceStateAccessor
- Parameters:
name
- the name- Returns:
- the value
- Throws:
PropertyException
-
getArray
public Object[] getArray(String name) throws PropertyException
Description copied from interface:StateAccessor
Gets an array value.- Specified by:
getArray
in interfaceStateAccessor
- Parameters:
name
- the name- Returns:
- the value
- Throws:
PropertyException
-
setSingle
public void setSingle(String name, Object value) throws PropertyException
Description copied from interface:StateAccessor
Sets a single value.- Specified by:
setSingle
in interfaceStateAccessor
- Parameters:
name
- the namevalue
- the value- Throws:
PropertyException
-
setArray
public void setArray(String name, Object[] value) throws PropertyException
Description copied from interface:StateAccessor
Sets an array value.- Specified by:
setArray
in interfaceStateAccessor
- Parameters:
name
- the namevalue
- the value- Throws:
PropertyException
-
-