public abstract class AbstractJcrNodeAdapter extends AbstractJcrAdapter
Item
wrapping/representing a Node
. Implements {Property.ValueChangeListener} in order to inform/change JCR
property when a Vaadin property has changed. Access JCR repository for all read Jcr Property.UNIDENTIFIED
Constructor and Description |
---|
AbstractJcrNodeAdapter(javax.jcr.Node jcrNode) |
Modifier and Type | Method and Description |
---|---|
AbstractJcrNodeAdapter |
addChild(AbstractJcrNodeAdapter child)
Add a child adapter to the current Item.
|
boolean |
addItemProperty(Object id,
com.vaadin.v7.data.Property property)
Add a new JCR Property.
|
javax.jcr.Node |
applyChanges()
Returns the JCR Node represented by this Item with changes applied.
|
AbstractJcrNodeAdapter |
getChild(String nodeName) |
Map<String,AbstractJcrNodeAdapter> |
getChildren() |
com.vaadin.v7.data.Property |
getItemProperty(Object id) |
javax.jcr.Node |
getJcrItem()
Return the corresponding node directly from the JCR repository.
|
String |
getNodeName()
Return the current Node Name.
|
AbstractJcrNodeAdapter |
getParent()
Return the current Parent Item (If Item is a child).
|
String |
getPrimaryNodeTypeName()
Return the Primary node type Name.
|
protected Map<String,AbstractJcrNodeAdapter> |
getRemovedChildren() |
boolean |
hasChildItemChanges() |
protected void |
initCommonAttributes(javax.jcr.Item jcrItem)
Init common Item attributes.
|
boolean |
isNode() |
protected void |
markPropertyForDeletion(String propertyId)
Marks the given property ID for removal upon next properties update (typically via #applyChanges).
|
boolean |
removeChild(AbstractJcrNodeAdapter toRemove)
Remove a child Node from the child list.
|
void |
setNodeName(String nodeName) |
void |
setParent(AbstractJcrNodeAdapter parent) |
protected void |
setPrimaryNodeTypeName(String primaryNodeTypeName) |
void |
updateChildren(javax.jcr.Node node)
Updates and removes children based on the
children and removedChildren maps. |
void |
updateProperties(javax.jcr.Item item)
Updates and removes properties on given item, based on the
AbstractJcrAdapter.changedProperties and AbstractJcrAdapter.removedProperties maps. |
protected void |
updateProperty(javax.jcr.Item item,
String propertyId,
com.vaadin.v7.data.Property property)
Update or remove property.
|
getChangedProperties, getItemId, getRemovedProperties, getWorkspace, hasChangedProperties, setItemId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isNew
public boolean isNode()
protected void initCommonAttributes(javax.jcr.Item jcrItem)
AbstractJcrAdapter
initCommonAttributes
in class AbstractJcrAdapter
protected void setPrimaryNodeTypeName(String primaryNodeTypeName)
public String getPrimaryNodeTypeName()
protected Map<String,AbstractJcrNodeAdapter> getRemovedChildren()
public javax.jcr.Node getJcrItem()
getJcrItem
in interface JcrItemAdapter
getJcrItem
in class AbstractJcrAdapter
public boolean addItemProperty(Object id, com.vaadin.v7.data.Property property)
public com.vaadin.v7.data.Property getItemProperty(Object id)
public javax.jcr.Node applyChanges() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void updateChildren(javax.jcr.Node node) throws javax.jcr.RepositoryException
children
and removedChildren
maps.
TODO: Has been made public as of MGNLUI-3124 resolution. Needs further API improvement (e.g. no-arg version or possibly some other better way to update the JCR node internals).javax.jcr.RepositoryException
public void updateProperties(javax.jcr.Item item) throws javax.jcr.RepositoryException
AbstractJcrAdapter
AbstractJcrAdapter.changedProperties
and AbstractJcrAdapter.removedProperties
maps. Read-only properties will not be updated and null valued properties will get removed.updateProperties
in class AbstractJcrAdapter
javax.jcr.RepositoryException
protected void updateProperty(javax.jcr.Item item, String propertyId, com.vaadin.v7.data.Property property)
updateProperties(javax.jcr.Item)
we have to make sure it is removed before running in here as Item.removeItemProperty(java.lang.Object)
is manipulating the AbstractJcrAdapter.changedProperties
list directly.updateProperty
in class AbstractJcrAdapter
protected void markPropertyForDeletion(String propertyId)
public AbstractJcrNodeAdapter getChild(String nodeName)
nodeName
- name of the child nodepublic Map<String,AbstractJcrNodeAdapter> getChildren()
public AbstractJcrNodeAdapter addChild(AbstractJcrNodeAdapter child)
public boolean removeChild(AbstractJcrNodeAdapter toRemove)
public AbstractJcrNodeAdapter getParent()
public void setParent(AbstractJcrNodeAdapter parent)
public String getNodeName()
public void setNodeName(String nodeName)
public boolean hasChildItemChanges()
Item
was added or removed, false otherwise.Copyright © 2018 Magnolia International Ltd.. All rights reserved.