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 Item
protected final SessionItemStateManager stateMgr
SessionItemStateManager
associated with this Item
protected <T> T perform(SessionOperation<T> operation) throws RepositoryException
RepositoryException
protected 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
RepositoryException
protected abstract void makePersistent() throws RepositoryException
RepositoryException
protected void setRemoved() throws RepositoryException
RepositoryException
- if an error occurspublic ItemId getId()
Item
.Item
public Path getPrimaryPath() throws RepositoryException
Item
.Item
RepositoryException
public String safeGetJCRPath()
id
to JCR path for use in
diagnostic output, error messages etc.public abstract Name getQName() throws RepositoryException
Name
RepositoryException
- 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 null
PropertyType.UNDEFINED
public abstract void accept(ItemVisitor visitor) throws RepositoryException
accept
in interface Item
RepositoryException
public abstract String getName() throws RepositoryException
getName
in interface Item
RepositoryException
public abstract Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException
getParent
in interface Item
ItemNotFoundException
AccessDeniedException
RepositoryException
protected boolean isTransactionalNew()
isNew()
but within a transaction an item can
be saved but not yet persisted.public boolean isModified()
isModified
in interface Item
public void remove() throws RepositoryException
remove
in interface Item
RepositoryException
public void save() throws RepositoryException
save
in interface Item
RepositoryException
public void refresh(boolean keepChanges) throws RepositoryException
refresh
in interface Item
RepositoryException
public Item getAncestor(int degree) throws RepositoryException
getAncestor
in interface Item
RepositoryException
public String getPath() throws RepositoryException
getPath
in interface Item
RepositoryException
public int getDepth() throws RepositoryException
getDepth
in interface Item
RepositoryException
public Session getSession()
Since Jackrabbit 1.4 it is safe to use this method regardless of item state.
getSession
in interface Item
public boolean isSame(Item otherItem) throws RepositoryException
isSame
in interface Item
RepositoryException
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.