Class JCRSupportImpl


  • public class JCRSupportImpl
    extends Object
    • Constructor Detail

      • JCRSupportImpl

        public JCRSupportImpl()
    • Method Detail

      • orderNode

        public void orderNode​(org.apache.sling.api.SlingHttpServletRequest request,
                              org.apache.sling.api.resource.Resource resource,
                              List<Modification> changes)
                       throws org.apache.sling.api.resource.PersistenceException
        Orders the given node according to the specified command. The following syntax is supported: <xmp> | first | before all child nodes | before A | before child node A | after A | after child node A | last | after all nodes | N | at a specific position, N being an integer </xmp>
        Parameters:
        request - The http request
        resource - the resource to order
        changes - the list of modifications
        Throws:
        org.apache.sling.api.resource.PersistenceException - in case the operation is not successful
      • isVersionable

        public boolean isVersionable​(org.apache.sling.api.resource.Resource rsrc)
                              throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • checkin

        public boolean checkin​(org.apache.sling.api.resource.Resource rsrc)
                        throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • checkoutIfNecessary

        public void checkoutIfNecessary​(org.apache.sling.api.resource.Resource resource,
                                        List<Modification> changes,
                                        VersioningConfiguration versioningConfiguration)
                                 throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • isNode

        public boolean isNode​(org.apache.sling.api.resource.Resource rsrc)
      • isNodeType

        public boolean isNodeType​(org.apache.sling.api.resource.Resource rsrc,
                                  String typeHint)
      • isFileNodeType

        public Boolean isFileNodeType​(org.apache.sling.api.resource.ResourceResolver resolver,
                                      String nodeType)
      • isPropertyProtectedOrNewAutoCreated

        public boolean isPropertyProtectedOrNewAutoCreated​(Object n,
                                                           String name)
                                                    throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • isNewNode

        public boolean isNewNode​(Object node)
      • isPropertyMandatory

        public boolean isPropertyMandatory​(Object node,
                                           String name)
                                    throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • isPropertyMultiple

        public boolean isPropertyMultiple​(Object node,
                                          String name)
                                   throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • getPropertyType

        public Integer getPropertyType​(Object node,
                                       String name)
                                throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • storeAsReference

        public Modification storeAsReference​(Object n,
                                             String name,
                                             String[] values,
                                             int type,
                                             boolean multiValued)
                                      throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • hasSession

        public boolean hasSession​(org.apache.sling.api.resource.ResourceResolver resolver)
      • setTypedProperty

        public void setTypedProperty​(Object n,
                                     String name,
                                     String[] values,
                                     int type,
                                     boolean multiValued)
                              throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • getNode

        public Object getNode​(org.apache.sling.api.resource.Resource rsrc)
      • getItem

        public Object getItem​(org.apache.sling.api.resource.Resource rsrc)
      • setPrimaryNodeType

        public void setPrimaryNodeType​(Object node,
                                       String type)
                                throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • move

        public void move​(Object src,
                         Object dstParent,
                         String name)
                  throws org.apache.sling.api.resource.PersistenceException
        Throws:
        org.apache.sling.api.resource.PersistenceException
      • copy

        public String copy​(Object src,
                           Object dstParent,
                           String name)
                    throws org.apache.sling.api.resource.PersistenceException
        Copy the src item into the dstParent node. The name of the newly created item is set to name.
        Parameters:
        src - The item to copy to the new location
        dstParent - The node into which the src node is to be copied
        name - The name of the newly created item. If this is null the new item gets the same name as the src item.
        Returns:
        the name of the newly created object
        Throws:
        org.apache.sling.api.resource.PersistenceException - May be thrown in case of any problem copying the content.
        org.apache.sling.api.resource.PersistenceException - in case something fails
        See Also:
        copy(Node, Node, String), copy(Property, Node, String)
      • isAncestorOrSameNode

        public static boolean isAncestorOrSameNode​(javax.jcr.Node src,
                                                   javax.jcr.Node dest)
                                            throws javax.jcr.RepositoryException
        determines if the 2 nodes are in ancestor relationship or identical
        Parameters:
        src - one node
        dest - the other node
        Returns:
        true if src is an ancestor node of dest, or if both are the same node
        Throws:
        javax.jcr.RepositoryException - if something goes wrong