public abstract class ItemImpl extends Object implements 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(ItemVisitor visitor) |
Item |
getAncestor(int degree) |
int |
getDepth() |
ItemId |
getId()
Return the id of this
Item. |
abstract String |
getName() |
protected abstract ItemState |
getOrCreateTransientItemState() |
abstract Node |
getParent() |
String |
getPath() |
Path |
getPrimaryPath()
Returns the primary path to this
Item. |
abstract Name |
getQName()
|
protected Name |
getQName(String name)
Utility method that converts the given string into a qualified JCR name.
|
Session |
getSession()
Returns the session associated with this item.
|
protected int |
getType(Value[] values)
Utility method that returns the type of the first of the given values,
or
PropertyType.UNDEFINED when given no values. |
protected ValueFactory |
getValueFactory()
Utility method that returns the value factory of this session.
|
protected 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(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 Itemprotected final SessionItemStateManager stateMgr
SessionItemStateManager associated with this Itemprotected <T> T perform(SessionOperation<T> operation) throws RepositoryException
RepositoryExceptionprotected void sanityCheck()
throws RepositoryException
RepositoryException - if this item has been rendered invalid for some reasonprotected void itemSanityCheck()
throws RepositoryException
RepositoryException - if this item no longer existsprotected boolean isTransient()
protected abstract ItemState getOrCreateTransientItemState() throws RepositoryException
RepositoryExceptionprotected abstract void makePersistent()
throws RepositoryException
RepositoryExceptionprotected void setRemoved()
throws RepositoryException
RepositoryException - if an error occurspublic ItemId getId()
Item.Itempublic Path getPrimaryPath() throws RepositoryException
Item.ItemRepositoryExceptionpublic String safeGetJCRPath()
id to JCR path for use in
diagnostic output, error messages etc.public abstract Name getQName() throws RepositoryException
NameRepositoryException - if an error occurs.protected Name getQName(String name) throws RepositoryException
name - name stringRepositoryException - if the given name is invalidprotected ValueFactory getValueFactory() throws RepositoryException
RepositoryException - if the value factory is not availableprotected Value[] getValues(String[] values, int type) throws RepositoryException
values - value stringstype - value typeRepositoryException - if the values can not be convertedprotected int getType(Value[] values)
PropertyType.UNDEFINED when given no values.values - given values, or nullPropertyType.UNDEFINEDpublic abstract void accept(ItemVisitor visitor) throws RepositoryException
accept in interface ItemRepositoryExceptionpublic abstract String getName() throws RepositoryException
getName in interface ItemRepositoryExceptionpublic abstract Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException
getParent in interface ItemItemNotFoundExceptionAccessDeniedExceptionRepositoryExceptionprotected boolean isTransactionalNew()
isNew() but within a transaction an item can
be saved but not yet persisted.public boolean isModified()
isModified in interface Itempublic void remove()
throws RepositoryException
remove in interface ItemRepositoryExceptionpublic void save()
throws RepositoryException
save in interface ItemRepositoryExceptionpublic void refresh(boolean keepChanges)
throws RepositoryException
refresh in interface ItemRepositoryExceptionpublic Item getAncestor(int degree) throws RepositoryException
getAncestor in interface ItemRepositoryExceptionpublic String getPath() throws RepositoryException
getPath in interface ItemRepositoryExceptionpublic int getDepth()
throws RepositoryException
getDepth in interface ItemRepositoryExceptionpublic Session getSession()
Since Jackrabbit 1.4 it is safe to use this method regardless of item state.
getSession in interface Itempublic boolean isSame(Item otherItem) throws RepositoryException
isSame in interface ItemRepositoryExceptionCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.