public class ImporterUtil
extends java.lang.Object
Constructor and Description |
---|
ImporterUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkCanvasPrimary(Resource resource)
Checks if the passed canvas is primary.
|
static boolean |
checkCanvasSecondary(Resource resource)
Checks if the passed canvas is secondary.
|
static void |
cleanupDanglingAscendants(Resource resource)
This method traverses up the hierarchy (uptil canvas dir) of the passed resource and deletes
all nodes without children.
|
static void |
deleteCanvasArtifact(Resource resource)
Deletes the canvas artifact along with any dangling ascendants.
|
static void |
deleteCanvasArtifact(Resource resource,
boolean cleanupDanglingAscendants)
Deletes the canvas artifact
|
static Resource |
findImporter(Resource resource)
Looks up importer in the passed page resource
|
static java.util.List<Resource> |
findImporters(Resource resource)
Finds importer resources within the page resource passed.
|
static java.util.List<Resource> |
findImporters(Resource resource,
boolean recursive)
Finds importer resources within the passed page resource.
|
static Resource |
getCanvas(Resource resource)
Convenience method to get canvas from the importer.
|
static Resource |
getCanvasDesign(Resource resource)
Returns the resource corresponding to the canvas design
|
static Resource |
getDanglingAscendantRoot(Resource resource)
For internal use
|
static boolean |
isCanvas(Resource resource)
Checks if the passed resource corresponds to a generated
canvas node based on the following heuristics:
Its parent has the resource type
ImporterConstants.RESOURCE_TYPE_IMPORTER
|
static boolean |
isImporter(Resource resource)
Checks if the passed resource corresponds to importer
|
static boolean |
isImporterPage(Page page)
Checks if the passed page is created using the
ImporterConstants.PAGE_TEMPLATE_IMPORTER_PAGE template |
static boolean |
isImporterPage(Resource resource)
Checks if the passed resource is a, or belongs to a page created using the
ImporterConstants.PAGE_TEMPLATE_IMPORTER_PAGE template |
public static Resource findImporter(Resource resource)
resource
- The page resource which needs to be searched for importer resourcepublic static java.util.List<Resource> findImporters(Resource resource)
resource
- The page resource which needs to be searched for importer resourcepublic static java.util.List<Resource> findImporters(Resource resource, boolean recursive)
resource
- The page resource which needs to be searched for importer resourcerecursive
- if true, all sub pages are looked up as wellpublic static boolean checkCanvasPrimary(Resource resource) throws java.lang.IllegalArgumentException
resource
- The resource corresponding to a canvasjava.lang.IllegalArgumentException
- When the passed resource is not a valid canvas resourcepublic static boolean checkCanvasSecondary(Resource resource) throws java.lang.IllegalArgumentException
Note: A design import typically results in one primary canvas accompanied by zero or more secondary canvases.
resource
- The resource corresponding to a canvasjava.lang.IllegalArgumentException
- When the passed resource is not a valid canvas resourcepublic static Resource getCanvasDesign(Resource resource)
resource
- The resource corresponding to a canvas or its container importer component nodepublic static Resource getCanvas(Resource resource)
resource
- public static boolean isCanvas(Resource resource)
ImporterConstants.RESOURCE_TYPE_IMPORTER
resource
- public static boolean isImporter(Resource resource)
resource
- public static boolean isImporterPage(Page page)
ImporterConstants.PAGE_TEMPLATE_IMPORTER_PAGE
templatepage
- public static boolean isImporterPage(Resource resource)
ImporterConstants.PAGE_TEMPLATE_IMPORTER_PAGE
templateresource
- The page resource or a resource contained within the pagepublic static void deleteCanvasArtifact(Resource resource) throws RepositoryException
resource
- Resource corresponding to a canvas artifact like canvas design or canvas componentRepositoryException
public static void deleteCanvasArtifact(Resource resource, boolean cleanupDanglingAscendants) throws RepositoryException
resource
- Resource corresponding to a canvas artifact like canvas design or canvas componentcleanupDanglingAscendants
- flag to indicate if ascendants left dangling,
because of the deleted canvas, also need to be cleaned up.RepositoryException
public static void cleanupDanglingAscendants(Resource resource) throws RepositoryException
RepositoryException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"