Package org.apache.sling.distribution.queue.impl.resource

## Class ResourceQueueUtils

- java.lang.Object
- - org.apache.sling.distribution.queue.impl.resource.ResourceQueueUtils

    public class ResourceQueueUtils
    extends Object

### Field Summary

Fields
`static String` `RESOURCE_FOLDER`

### Constructor Summary

Constructors
`ResourceQueueUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static org.apache.sling.api.resource.Resource` `createResource​(org.apache.sling.api.resource.Resource root, DistributionQueueItem queueItem)`
`static void` `deleteResource​(org.apache.sling.api.resource.Resource resource)`
`static org.apache.sling.api.resource.Resource` `getResourceById​(org.apache.sling.api.resource.Resource root, String entryId)`
`static int` `getResourceCount​(org.apache.sling.api.resource.Resource root)`
`static org.apache.sling.api.resource.Resource` `getRootResource​(org.apache.sling.api.resource.ResourceResolver resourceResolver, String rootPath)`
`static String` `getTimePath​(Calendar now)` Transforms current time to path 2018/01/03/23/54
`static void` `incrementProcessingAttemptForQueueItem​(org.apache.sling.api.resource.Resource queueItemResource)`
`static boolean` `isSafeToDelete​(String nowPath, String path)` Checks if path is safe to delete at this time.
`static String` `unescapeId​(String itemId)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### RESOURCE_FOLDER

    public static final String RESOURCE_FOLDER

See Also:
  Constant Field Values

### Constructor Detail

#### ResourceQueueUtils

    public ResourceQueueUtils()

### Method Detail

#### getRootResource

    public static org.apache.sling.api.resource.Resource getRootResource​(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                                         String rootPath)
                                                                  throws org.apache.sling.api.resource.PersistenceException

Throws:
  `org.apache.sling.api.resource.PersistenceException`

#### getResourceById

    public static org.apache.sling.api.resource.Resource getResourceById​(org.apache.sling.api.resource.Resource root,
                                                                         String entryId)

#### createResource

    public static org.apache.sling.api.resource.Resource createResource​(org.apache.sling.api.resource.Resource root,
                                                                        DistributionQueueItem queueItem)
                                                                 throws org.apache.sling.api.resource.PersistenceException

Throws:
  `org.apache.sling.api.resource.PersistenceException`

#### deleteResource

    public static void deleteResource​(org.apache.sling.api.resource.Resource resource)
                               throws org.apache.sling.api.resource.PersistenceException

Throws:
  `org.apache.sling.api.resource.PersistenceException`

#### getResourceCount

    public static int getResourceCount​(org.apache.sling.api.resource.Resource root)

#### getTimePath

    public static String getTimePath​(Calendar now)

Transforms current time to path 2018/01/03/23/54

Parameters:
  `now` - the current time
Returns:
  the serialized time

#### isSafeToDelete

    public static boolean isSafeToDelete​(String nowPath,
                                         String path)

Checks if path is safe to delete at this time. A path is safe to delete if the nowPath does not overlap with it.

Parameters:
  `nowPath` - represents a full path of current time (e.g. 2018/01/03/23/54)
  `path` - the path to be checked (it can be a partial path e.g. 2018/01)
Returns:
  true if checked path is in the past

#### unescapeId

    public static String unescapeId​(String itemId)

#### incrementProcessingAttemptForQueueItem

    public static void incrementProcessingAttemptForQueueItem​(org.apache.sling.api.resource.Resource queueItemResource)