| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.jcr.resource.JcrResourceUtil
public class JcrResourceUtil
The JcrResourceUtil class provides helper methods used
 throughout this bundle.
| Constructor Summary | |
|---|---|
JcrResourceUtil()
 | 
|
| Method Summary | |
|---|---|
static javax.jcr.Node | 
createPath(javax.jcr.Node parentNode,
           String relativePath,
           String intermediateNodeType,
           String nodeType,
           boolean autoSave)
Creates or gets the Node at the given Path. | 
static javax.jcr.Node | 
createPath(String path,
           String intermediateNodeType,
           String nodeType,
           javax.jcr.Session session,
           boolean autoSave)
Creates or gets the Node at the given Path. | 
static javax.jcr.Value | 
createValue(Object value,
            javax.jcr.Session session)
Creates a JCR Value for the given object with
 the given Session. | 
static String | 
getResourceSuperType(Resource resource)
Deprecated. Call ResourceUtil.findResourceSuperType(Resource) | 
static String | 
getResourceSuperType(ResourceResolver resourceResolver,
                     String resourceType)
Deprecated. Use ResourceUtil.getResourceSuperType(ResourceResolver, String) | 
static javax.jcr.query.QueryResult | 
query(javax.jcr.Session session,
      String query,
      String language)
Helper method to execute a JCR query  | 
static String | 
resourceTypeToPath(String type)
Deprecated. Use ResourceUtil.resourceTypeToPath(String) | 
static void | 
setProperty(javax.jcr.Node node,
            String propertyName,
            Object propertyValue)
Sets the value of the property.  | 
static Object | 
toJavaObject(javax.jcr.Property property)
Converts the value(s) of a JCR Property to a corresponding Java Object.  | 
static Object | 
toJavaObject(javax.jcr.Value value)
Converts a JCR Value to a corresponding Java Object  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public JcrResourceUtil()
| Method Detail | 
|---|
public static javax.jcr.query.QueryResult query(javax.jcr.Session session,
                                                String query,
                                                String language)
                                         throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Object toJavaObject(javax.jcr.Value value)
                           throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Object toJavaObject(javax.jcr.Property property)
                           throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Value createValue(Object value,
                                          javax.jcr.Session session)
                                   throws javax.jcr.RepositoryException
JCR Value for the given object with
 the given Session.
 Selects the the PropertyType according
 the instance of the object's Class
value - objectsession - to create value for
javax.jcr.RepositoryException - in case of error, accessing the Repository
public static void setProperty(javax.jcr.Node node,
                               String propertyName,
                               Object propertyValue)
                        throws javax.jcr.RepositoryException
PropertyType according
 to the instance of the object's class.
node - The node where the property will be set on.propertyName - The name of the property.propertyValue - The value for the property.
javax.jcr.RepositoryException@Deprecated public static String resourceTypeToPath(String type)
ResourceUtil.resourceTypeToPath(String)
Resource.getResourceType() as a
 relative path.
type - The resource type to be converted into a path
@Deprecated
public static String getResourceSuperType(ResourceResolver resourceResolver,
                                                     String resourceType)
ResourceUtil.getResourceSuperType(ResourceResolver, String)
JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY of the
 Resource addressed by the resourceType to a
 string. If no such child resource exists or if the resource does not
 adapt to a string, this method returns null.
resourceResolver - The ResourceResolver used to
            access the resource whose path (relative or absolute) is given
            by the resourceType parameter.resourceType - The resource type whose super type is to be returned.
            This type is turned into a path by calling the
            resourceTypeToPath(String) method before trying to
            get the resource through the resourceResolver.
resourceType or
         null if the resource type does not have a child
         resource
         JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY
         adapting to a string.@Deprecated public static String getResourceSuperType(Resource resource)
ResourceUtil.findResourceSuperType(Resource)
JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY if the
 given resource adapted to a string or the result of
 calling the getResourceSuperType(ResourceResolver, String)
 method on the resource type of the resource.
 This mechanism allows to specifically set the resource super type on a per-resource level overwriting any resource super type hierarchy pre-defined by the actual resource type of the resource.
resource - The Resource whose resource super type is
            requested.
null if the algorithm
         described above does not yield a resource super type.
public static javax.jcr.Node createPath(String path,
                                        String intermediateNodeType,
                                        String nodeType,
                                        javax.jcr.Session session,
                                        boolean autoSave)
                                 throws javax.jcr.RepositoryException
Node at the given Path.
 In case it has to create the Node all non-existent intermediate path-elements
 will be create with the given intermediate node type and the returned node
 will be created with the given nodeType
path - to createintermediateNodeType - to use for creation of intermediate nodes (or null)nodeType - to use for creation of the final node (or null)session - to useautoSave - Should save be called when a new node is created?
javax.jcr.RepositoryException - in case of exception accessing the Repository
public static javax.jcr.Node createPath(javax.jcr.Node parentNode,
                                        String relativePath,
                                        String intermediateNodeType,
                                        String nodeType,
                                        boolean autoSave)
                                 throws javax.jcr.RepositoryException
Node at the given Path.
 In case it has to create the Node all non-existent intermediate path-elements
 will be create with the given intermediate node type and the returned node
 will be created with the given nodeType
parentNode - starting noderelativePath - to createintermediateNodeType - to use for creation of intermediate nodes (or null)nodeType - to use for creation of the final node (or null)autoSave - Should save be called when a new node is created?
javax.jcr.RepositoryException - in case of exception accessing the Repository
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||