public abstract class ItemImpl extends Object implements javax.jcr.Item
ItemImpl
implements the Item
interface.Modifier and Type | Field and Description |
---|---|
protected ItemData |
data
Item data associated with this item.
|
protected ItemId |
id |
protected ItemManager |
itemMgr
ItemManager that created this Item |
protected SessionContext |
sessionContext
The component context of the session to which this item is associated.
|
protected SessionItemStateManager |
stateMgr
SessionItemStateManager associated with this Item |
protected static int |
STATUS_DESTROYED |
protected static int |
STATUS_INVALIDATED |
protected static int |
STATUS_MODIFIED |
protected static int |
STATUS_NORMAL |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(javax.jcr.ItemVisitor visitor) |
javax.jcr.Item |
getAncestor(int degree) |
int |
getDepth() |
ItemId |
getId()
Return the id of this
Item . |
abstract String |
getName() |
protected abstract ItemState |
getOrCreateTransientItemState() |
abstract javax.jcr.Node |
getParent() |
String |
getPath() |
Path |
getPrimaryPath()
Returns the primary path to this
Item . |
abstract Name |
getQName()
Same as
except that
this method returns a Name instead of a
String . |
protected Name |
getQName(String name)
Utility method that converts the given string into a qualified JCR name.
|
javax.jcr.Session |
getSession()
Returns the session associated with this item.
|
protected int |
getType(javax.jcr.Value[] values)
Utility method that returns the type of the first of the given values,
or
PropertyType.UNDEFINED when given no values. |
protected javax.jcr.ValueFactory |
getValueFactory()
Utility method that returns the value factory of this session.
|
protected javax.jcr.Value[] |
getValues(String[] values,
int type)
Utility method that converts the given strings into JCR values of the
given type
|
boolean |
isModified() |
boolean |
isNew() |
abstract boolean |
isNode() |
boolean |
isSame(javax.jcr.Item otherItem) |
protected boolean |
isTransactionalNew()
checks if this item is new.
|
protected boolean |
isTransient() |
protected void |
itemSanityCheck()
Checks the status of this item.
|
protected abstract void |
makePersistent() |
protected <T> T |
perform(SessionOperation<T> operation) |
void |
refresh(boolean keepChanges) |
void |
remove() |
String |
safeGetJCRPath()
Failsafe mapping of internal
id to JCR path for use in
diagnostic output, error messages etc. |
protected void |
sanityCheck()
Performs a sanity check on this item and the associated session.
|
void |
save() |
protected void |
setRemoved()
Marks this instance as 'removed' and notifies its listeners.
|
String |
toString()
Returns the(
safe ) path of this item for use
in diagnostic output. |
protected static final int STATUS_NORMAL
protected static final int STATUS_MODIFIED
protected static final int STATUS_DESTROYED
protected static final int STATUS_INVALIDATED
protected final ItemId id
protected final SessionContext sessionContext
protected final ItemData data
protected final ItemManager itemMgr
ItemManager
that created this Item
protected final SessionItemStateManager stateMgr
SessionItemStateManager
associated with this Item
protected <T> T perform(SessionOperation<T> operation) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void sanityCheck() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if this item has been rendered invalid for some reasonprotected void itemSanityCheck() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if this item no longer existsprotected boolean isTransient()
protected abstract ItemState getOrCreateTransientItemState() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected abstract void makePersistent() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void setRemoved() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic ItemId getId()
Item
.Item
public Path getPrimaryPath() throws javax.jcr.RepositoryException
Item
.Item
javax.jcr.RepositoryException
public String safeGetJCRPath()
id
to JCR path for use in
diagnostic output, error messages etc.public abstract Name getQName() throws javax.jcr.RepositoryException
Item.getName()
except that
this method returns a Name
instead of a
String
.Name
javax.jcr.RepositoryException
- if an error occurs.protected Name getQName(String name) throws javax.jcr.RepositoryException
name
- name stringjavax.jcr.RepositoryException
- if the given name is invalidprotected javax.jcr.ValueFactory getValueFactory() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if the value factory is not availableprotected javax.jcr.Value[] getValues(String[] values, int type) throws javax.jcr.RepositoryException
values
- value stringstype
- value typejavax.jcr.RepositoryException
- if the values can not be convertedprotected int getType(javax.jcr.Value[] values)
PropertyType.UNDEFINED
when given no values.values
- given values, or null
PropertyType.UNDEFINED
public abstract void accept(javax.jcr.ItemVisitor visitor) throws javax.jcr.RepositoryException
accept
in interface javax.jcr.Item
javax.jcr.RepositoryException
public abstract boolean isNode()
isNode
in interface javax.jcr.Item
public abstract String getName() throws javax.jcr.RepositoryException
getName
in interface javax.jcr.Item
javax.jcr.RepositoryException
public abstract javax.jcr.Node getParent() throws javax.jcr.ItemNotFoundException, javax.jcr.AccessDeniedException, javax.jcr.RepositoryException
getParent
in interface javax.jcr.Item
javax.jcr.ItemNotFoundException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
public boolean isNew()
isNew
in interface javax.jcr.Item
protected boolean isTransactionalNew()
isNew()
but within a transaction an item can
be saved but not yet persisted.public boolean isModified()
isModified
in interface javax.jcr.Item
public void remove() throws javax.jcr.RepositoryException
remove
in interface javax.jcr.Item
javax.jcr.RepositoryException
public void save() throws javax.jcr.RepositoryException
save
in interface javax.jcr.Item
javax.jcr.RepositoryException
public void refresh(boolean keepChanges) throws javax.jcr.RepositoryException
refresh
in interface javax.jcr.Item
javax.jcr.RepositoryException
public javax.jcr.Item getAncestor(int degree) throws javax.jcr.RepositoryException
getAncestor
in interface javax.jcr.Item
javax.jcr.RepositoryException
public String getPath() throws javax.jcr.RepositoryException
getPath
in interface javax.jcr.Item
javax.jcr.RepositoryException
public int getDepth() throws javax.jcr.RepositoryException
getDepth
in interface javax.jcr.Item
javax.jcr.RepositoryException
public javax.jcr.Session getSession()
Since Jackrabbit 1.4 it is safe to use this method regardless of item state.
getSession
in interface javax.jcr.Item
public boolean isSame(javax.jcr.Item otherItem) throws javax.jcr.RepositoryException
isSame
in interface javax.jcr.Item
javax.jcr.RepositoryException
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.