Class AbstractJcrConverter
- java.lang.Object
-
- org.silverpeas.core.persistence.jcr.AbstractJcrConverter
-
public abstract class AbstractJcrConverter extends Object
- Author:
- ehugonnet
-
-
Constructor Summary
Constructors Constructor Description AbstractJcrConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDateProperty(javax.jcr.Node node, String propertyName, Date value)
Defines the Calendar value of a JCR Node's property.void
addStringProperty(javax.jcr.Node node, String propertyName, String value)
Defines the value of a JCR Node's property.javax.jcr.Binary
getBinaryContent(javax.jcr.Node fileNode)
protected Boolean
getBooleanProperty(javax.jcr.Node node, String propertyName, Boolean defaultValueIfNull)
Return the property value as a boolean for a JCR Node.protected String
getComponentId(javax.jcr.Node node)
Compute the componentId corresponding to the specified node by checking the name of the first Ancestor.byte[]
getContent(javax.jcr.Node fileNode)
void
getContent(javax.jcr.Node fileNode, OutputStream out)
protected Date
getDateProperty(javax.jcr.Node node, String propertyName)
Return the property value as java.util.Date for a JCR Node.javax.jcr.Node
getFolder(javax.jcr.Node parent, String name)
Return the node with the specified parent and name.protected int
getIntProperty(javax.jcr.Node node, String propertyName)
Return the property value as an int for a JCR Node.protected long
getLongProperty(javax.jcr.Node node, String propertyName)
Return the property value as an long for a JCR Node.protected String
getStringProperty(javax.jcr.Node node, String propertyName)
Return the property value as String for a JCR Node.static boolean
isMixinApplied(javax.jcr.Node node, String mixin)
Return true if the specified mixin type is explicitly assigned to the node.void
setContent(javax.jcr.Node fileNode, byte[] content, String mimeType)
Add binary content to the specified node.void
setContent(javax.jcr.Node fileNode, File file, String mimeType)
void
setContent(javax.jcr.Node fileNode, InputStream content, String mimeType)
-
-
-
Method Detail
-
getStringProperty
protected String getStringProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
Return the property value as String for a JCR Node. If the property doesn't exist return null.- Parameters:
node
- the node whose property is required.propertyName
- the name of the property required.- Returns:
- the String value of the property - null if the property doesn't exist.
- Throws:
javax.jcr.RepositoryException
- on error
-
getComponentId
protected String getComponentId(javax.jcr.Node node) throws javax.jcr.RepositoryException
Compute the componentId corresponding to the specified node by checking the name of the first Ancestor.- Parameters:
node
- the node whose componentId is required.- Returns:
- the componentId of the specified node.
- Throws:
javax.jcr.RepositoryException
- on error
-
addStringProperty
public void addStringProperty(javax.jcr.Node node, String propertyName, String value) throws javax.jcr.RepositoryException
Defines the value of a JCR Node's property. If the specified value is null then the corresponding property is removed from the Node.- Parameters:
node
- the node whose property is being set.propertyName
- the name of the property being set.value
- the value being set. If it is null then the property is removed.- Throws:
javax.jcr.RepositoryException
- on error
-
addDateProperty
public void addDateProperty(javax.jcr.Node node, String propertyName, Date value) throws javax.jcr.RepositoryException
Defines the Calendar value of a JCR Node's property. If the specified value is null then the corresponding property is removed from the Node.- Parameters:
node
- the node whose property is being set.propertyName
- the name of the property being set.value
- the value being set. If it is null then the property is removed.- Throws:
javax.jcr.RepositoryException
- on error
-
getDateProperty
protected Date getDateProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
Return the property value as java.util.Date for a JCR Node. If the property doesn't exist return null.- Parameters:
node
- the node whose property is required.propertyName
- the name of the property required.- Returns:
- the java.util.Date value of the property - null if the property doesn't exist.
- Throws:
javax.jcr.RepositoryException
- on error
-
getIntProperty
protected int getIntProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
Return the property value as an int for a JCR Node. If the property doesn't exist return 0.- Parameters:
node
- the node whose property is required.propertyName
- the name of the property required.- Returns:
- the int value of the property - 0 if the property doesn't exist.
- Throws:
javax.jcr.RepositoryException
- on error
-
getBooleanProperty
protected Boolean getBooleanProperty(javax.jcr.Node node, String propertyName, Boolean defaultValueIfNull) throws javax.jcr.RepositoryException
Return the property value as a boolean for a JCR Node. If the property doesn't exist return false.- Parameters:
node
- the node whose property is required.propertyName
- the name of the property required.defaultValueIfNull
- the default value of the value does not exist- Returns:
- the boolean value of the property - false if the property doesn't exist.
- Throws:
javax.jcr.RepositoryException
- on error
-
getLongProperty
protected long getLongProperty(javax.jcr.Node node, String propertyName) throws javax.jcr.RepositoryException
Return the property value as an long for a JCR Node. If the property doesn't exist return 0.- Parameters:
node
- the node whose property is required.propertyName
- the name of the property required.- Returns:
- the long value of the property - 0 if the property doesn't exist.
- Throws:
javax.jcr.RepositoryException
- on error
-
setContent
public void setContent(javax.jcr.Node fileNode, InputStream content, String mimeType) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setContent
public void setContent(javax.jcr.Node fileNode, File file, String mimeType) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setContent
public void setContent(javax.jcr.Node fileNode, byte[] content, String mimeType) throws javax.jcr.RepositoryException
Add binary content to the specified node.- Parameters:
fileNode
- the node.content
- the binary content.mimeType
- the mime type of the content.- Throws:
javax.jcr.RepositoryException
- on error
-
getContent
public byte[] getContent(javax.jcr.Node fileNode) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getBinaryContent
public javax.jcr.Binary getBinaryContent(javax.jcr.Node fileNode) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getContent
public void getContent(javax.jcr.Node fileNode, OutputStream out) throws javax.jcr.RepositoryException, IOException
- Throws:
javax.jcr.RepositoryException
IOException
-
getFolder
public javax.jcr.Node getFolder(javax.jcr.Node parent, String name) throws javax.jcr.RepositoryException
Return the node with the specified parent and name. Create a nt:folder with the specified parent and name if the node doesn't exist.- Parameters:
parent
- parent node of the folder.name
- name of the folder.- Returns:
- the node with the specified parent and name.
- Throws:
javax.jcr.RepositoryException
- on error
-
isMixinApplied
public static boolean isMixinApplied(javax.jcr.Node node, String mixin) throws javax.jcr.RepositoryException
Return true if the specified mixin type is explicitly assigned to the node. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy or through the addition of supertypes to the type hierarchy of any of the declared mixin types.- Parameters:
node
- the node on which we are looking for the specified mixin.mixin
- the name of the mixin.- Returns:
- rue if the specified mixin type is explicitly assigned to the node false otherwise.
- Throws:
javax.jcr.RepositoryException
- on error
-
-