Package org.craftercms.core.service
Class Item
java.lang.Object
org.craftercms.core.util.cache.impl.AbstractCachingAwareObject
org.craftercms.core.service.Item
- All Implemented Interfaces:
CachingAwareObject
- Direct Known Subclasses:
Tree
Represents an item of a content store. Content store items can be separated into 3 main categories:
- Standalone descriptors: XML files that contain metadata and content for web pages. These type of descriptors are in themselves items, so the item url and the descriptor url should be the same.
- Regular files: Regular non-descriptor files (like documents, images, templates, scripts, etc)
- Folders: Plain old folders/directories.
Both regular files and folders can have their own metadata files or descriptors. So we can also say that there are two types of descriptors: standalone descriptors and (regular file and folder) metadata files.
- Author:
- Sumer Jabri, Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.dom4j.Document
The DOM (Document Object Model) of the item's descriptor.protected String
The url or path of the item's descriptor in the content store.protected boolean
Flag that indicates if the item is a folder or not.protected String
The name of the item (basically the file name).The properties of the item, which most of the time are metadata information on the item.protected String
The url or path of the item in the content store.Fields inherited from class org.craftercms.core.util.cache.impl.AbstractCachingAwareObject
cachingTime, key, scope
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the specifiedItem
's and this instance'sname
,url
,descriptorUrl
andisFolder
are equal.org.dom4j.Document
Returns the DOM (Document Object Model) of the item's descriptor.Returns the url or path of the item's descriptor in the content store.getName()
Returns name of the item (basically the file name).Returns the properties of the item, which most of the time are metadata information on the item.getProperty
(String key) Returns the property value for the specified key.getUrl()
Returns the url or path of the item in the content store.int
hashCode()
Returns the hash code, which is the combination of the hash code ofname
,url
,descriptorUrl
andfolder
.boolean
isFolder()
Returns true if the item is a folder.queryDescriptorValue
(String xpathQuery) Queries a single descriptor node text value.queryDescriptorValues
(String xpathQuery) Queries multiple descriptor node text values.void
setDescriptorDom
(org.dom4j.Document descriptorDom) Sets the DOM (Document Object Model) of the item's descriptor.void
setDescriptorUrl
(String descriptorUrl) Sets the url or path of the item's descriptor in the content store.void
setFolder
(boolean folder) Sets whether the item is a folder or not.void
Sets the name of the item (basically the file name).void
setProperties
(Map<String, Object> properties) Sets properties of the item, which most of the time are metadata information on the item.void
setProperty
(String key, Object value) Adds the specified property value, associated to the specified key.void
Sets the url or path of the item in the content store.toString()
Methods inherited from class org.craftercms.core.util.cache.impl.AbstractCachingAwareObject
getCachingTime, getKey, getScope, setCachingTime, setKey, setScope
-
Field Details
-
name
The name of the item (basically the file name). -
url
The url or path of the item in the content store. -
descriptorUrl
The url or path of the item's descriptor in the content store. If the item is a standalone descriptor, thedescriptorUrl
will be the same as theurl
. -
descriptorDom
protected org.dom4j.Document descriptorDomThe DOM (Document Object Model) of the item's descriptor. -
properties
The properties of the item, which most of the time are metadata information on the item. -
isFolder
protected boolean isFolderFlag that indicates if the item is a folder or not.
-
-
Constructor Details
-
Item
public Item()Default no-arg constructor. -
Item
Copy constructor. Performs a deep copy (callsItem(Item, boolean)
with true). -
Item
Copy constructor. Performs a deep copy depending on the value of thedeepCopy
flag. In a deep copy, thedescriptorDom
andproperties
are cloned.
-
-
Method Details
-
getName
Returns name of the item (basically the file name). -
setName
Sets the name of the item (basically the file name). -
getUrl
Returns the url or path of the item in the content store. -
setUrl
Sets the url or path of the item in the content store. -
getDescriptorUrl
Returns the url or path of the item's descriptor in the content store. If the item is a standalone descriptor, thedescriptorUrl
will be the same as theurl
. -
setDescriptorUrl
Sets the url or path of the item's descriptor in the content store. If the item is a standalone descriptor, thedescriptorUrl
should be set to the same value as theurl
. -
getDescriptorDom
public org.dom4j.Document getDescriptorDom()Returns the DOM (Document Object Model) of the item's descriptor. -
setDescriptorDom
public void setDescriptorDom(org.dom4j.Document descriptorDom) Sets the DOM (Document Object Model) of the item's descriptor. -
getProperties
Returns the properties of the item, which most of the time are metadata information on the item. -
setProperties
Sets properties of the item, which most of the time are metadata information on the item. -
getProperty
Returns the property value for the specified key. -
setProperty
Adds the specified property value, associated to the specified key. -
queryDescriptorValue
Queries a single descriptor node text value. First looks in the properties, if not found it executes the XPath query. -
queryDescriptorValues
Queries multiple descriptor node text values. First looks in the properties, if not found it executes the XPath query. -
isFolder
public boolean isFolder()Returns true if the item is a folder. -
setFolder
public void setFolder(boolean folder) Sets whether the item is a folder or not. -
equals
Returns true if the specifiedItem
's and this instance'sname
,url
,descriptorUrl
andisFolder
are equal. -
hashCode
public int hashCode()Returns the hash code, which is the combination of the hash code ofname
,url
,descriptorUrl
andfolder
. -
toString
-