public class UIHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
UIHelper.ActionRelsRequestProperties |
static class |
UIHelper.ActionRelsResourceProperties
Structs for specifying action rel filters
Want to create bitmaps for fast comparison.
|
static class |
UIHelper.ActionRelsUserProperties |
Constructor and Description |
---|
UIHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canRenderOnWeb(java.lang.String mimeType)
Returns true if the given mime type can be rendered in HTML by browser.
|
static Privilege[] |
getAllPermission(AccessControlManager acm,
Resource res)
returns the privileges the session has for the given resource
|
static java.lang.String |
getAltText(Resource resource)
Returns alternate text that is to be used in place of the image when
displaying the resource's thumbnail
|
static java.util.List<java.lang.String> |
getAssetActionRels(boolean hasJcrRead,
boolean hasJcrWrite,
boolean hasAddChild,
boolean canEdit,
boolean canAnnotate,
boolean isAdmin,
boolean isAssetExpired,
boolean isSubAssetExpired,
boolean isContentFragment,
boolean isArchive,
boolean isSnippetTemplate,
boolean isDownloadable,
boolean isOmniSearchRequest,
boolean isStockAsset,
boolean isStockAssetLicensed,
boolean isStockAccessible,
boolean isLiveCopy)
Returns list of actions rels string for assets
|
static java.util.List<java.lang.String> |
getAssetActionRels(UIHelper.ActionRelsResourceProperties resource,
UIHelper.ActionRelsUserProperties user,
UIHelper.ActionRelsRequestProperties request)
Returns list of actions rels string for assets
|
static Rendition |
getBestfitRendition(Asset asset,
int width)
Returns best fit rendition, whose width is nearer to given width.
|
static Rendition |
getBestFitRendtionBasedOnSize(Asset asset,
long size)
Returns best fit rendition, whose size is nearer to given size.
|
static Rendition |
getBestFitRendtionBasedOnSize(Asset asset,
long size,
boolean preferOriginal)
Returns best fit rendition, whose size is nearer to given size.
|
static long |
getCacheKiller(Node node)
Returns the cache killer number that can be appended the resource request.
|
static java.lang.String |
getCheckedOutby(Asset asset) |
static Resource |
getCurrentSuffixResource(SlingHttpServletRequest request)
returns the resource represented by the suffix.
|
static java.util.List<java.lang.String> |
getDirectoryActionRels(boolean hasJcrRead,
boolean hasModifyAccessControl,
boolean hasJcrWrite,
boolean hasReplicate,
boolean isMACShared,
boolean isCCShared,
boolean isRootMACShared,
boolean isMPShared,
boolean isRootMPShared,
boolean isLiveCopy)
|
static java.util.List<java.lang.String> |
getDirectoryActionRels(boolean hasJcrRead,
boolean hasModifyAccessControl,
boolean hasJcrWrite,
boolean hasReplicate,
boolean isMACShared,
boolean isCCShared,
boolean isRootMACShared,
boolean isMPShared,
boolean isRootMPShared,
boolean isLiveCopy,
boolean hasAddChild,
boolean hasRemoveNode,
boolean hasModifyProperties)
Returns list of actions rels string for directories
|
static int |
getHeight(Rendition r)
Returns the height of rendition if it is the original rendition,
and has dimension metadata, or if it follows the naming convention
cq5dam.[thumbnail|web].width.height.ext,else 0
|
static java.lang.String |
getResolutionLabel(long width,
long height,
SlingHttpServletRequest slingRequest)
Display resolution with correct i18n number formatting
|
static java.lang.String |
getSizeLabel(double size)
Adds units to given size in bytes and create label to be displayed in UI
|
static java.lang.String |
getSizeLabel(double size,
SlingHttpServletRequest slingRequest)
Adds units to given size in bytes and create label to be displayed in UI
and Internationalize the result.
|
static java.lang.String |
getTitle(Resource res)
Returns the title of a resource.
|
static int |
getWidth(Rendition r)
Returns the width of rendition if it is the original rendition,
and has dimension metadata, or if it follows the naming convention
cq5dam.[thumbnail|web].width.height.ext,else 0
|
static boolean |
hasPermission(AccessControlManager acm,
Resource res,
java.lang.String privilege)
returns whether the given resource has the permission to perform the
privileged action
|
static boolean |
isCheckedOutByDrive(Asset asset)
Returns true, if an asset is checked out by drive.
|
static boolean |
isEditSupportedFormat(java.lang.String mimetype)
returns whether Interactive Edit(crop/rotate) operations are supported on
the given mimetype
|
static java.lang.String |
lookupMimeType(java.lang.String mimeType,
Node node,
boolean uppercase)
Deprecated.
|
static java.lang.String |
lookupMimeType(java.lang.String mimeType,
Resource resource,
boolean uppercase)
does a lookup for the given mimetype in the given resource.
|
public static java.lang.String getTitle(Resource res)
dc:title
metadata property is return if resource represents a DAM asset
returns Page title if the resource represents a cq:Page
returns title if it is a LabeledResource
in other cases, it returns name of the resource or jcr:title property if existsres
- a resourcepublic static Rendition getBestfitRendition(Asset asset, int width)
asset
- dam assetwidth
- width of thumbnail in pixelspublic static java.lang.String getAltText(Resource resource)
resource
- The resource whose alt text need to be found.public static long getCacheKiller(Node node)
node
- a nodepublic static Resource getCurrentSuffixResource(SlingHttpServletRequest request)
request
- sling requestpublic static java.lang.String getSizeLabel(double size)
size
- size in bytespublic static java.lang.String getSizeLabel(double size, SlingHttpServletRequest slingRequest)
size
- size in bytespublic static java.lang.String getResolutionLabel(long width, long height, SlingHttpServletRequest slingRequest)
width
- widthheight
- heightslingRequest
- requestpublic static boolean hasPermission(AccessControlManager acm, Resource res, java.lang.String privilege) throws RepositoryException
acm
- AccessControlManager to determine the permissionsres
- resourceprivilege
- action, wanted to perform on the resRepositoryException
public static Privilege[] getAllPermission(AccessControlManager acm, Resource res) throws PathNotFoundException, RepositoryException
acm
- AccessControlManager to determine the permissionsres
- resourceRepositoryException
PathNotFoundException
public static boolean isEditSupportedFormat(java.lang.String mimetype)
mimetype
- public static Rendition getBestFitRendtionBasedOnSize(Asset asset, long size)
asset
- dam assetsize
- size in KBpublic static Rendition getBestFitRendtionBasedOnSize(Asset asset, long size, boolean preferOriginal)
asset
- dam assetsize
- size in KBpreferOriginal
- return original if size of best fit rendition is greaterpublic static boolean canRenderOnWeb(java.lang.String mimeType)
mimeType
- public static int getWidth(Rendition r)
r
- Rendition whose width is requiredpublic static int getHeight(Rendition r)
r
- Rendition whose width is required@Deprecated public static java.lang.String lookupMimeType(java.lang.String mimeType, Node node, boolean uppercase)
public static java.lang.String lookupMimeType(java.lang.String mimeType, Resource resource, boolean uppercase)
mimeType
- resource
- uppercase
- public static boolean isCheckedOutByDrive(Asset asset)
asset
- Asset whose status needs to be determinedpublic static java.lang.String getCheckedOutby(Asset asset)
public static java.util.List<java.lang.String> getAssetActionRels(UIHelper.ActionRelsResourceProperties resource, UIHelper.ActionRelsUserProperties user, UIHelper.ActionRelsRequestProperties request)
resource
- - properties of the resource in questionuser
- - properties of the current principalrequest
- - properties of the request itselfpublic static java.util.List<java.lang.String> getAssetActionRels(boolean hasJcrRead, boolean hasJcrWrite, boolean hasAddChild, boolean canEdit, boolean canAnnotate, boolean isAdmin, boolean isAssetExpired, boolean isSubAssetExpired, boolean isContentFragment, boolean isArchive, boolean isSnippetTemplate, boolean isDownloadable, boolean isOmniSearchRequest, boolean isStockAsset, boolean isStockAssetLicensed, boolean isStockAccessible, boolean isLiveCopy)
hasJcrRead
- hasJcrRead flaghasJcrWrite
- hasJcrWrite flaghasAddChild
- hasAddChild flagcanEdit
- canEdit flagcanAnnotate
- canAnnotate flagisAdmin
- isAdmin flagisAssetExpired
- isAssetExpired flagisSubAssetExpired
- isSubAssetExpired flagisContentFragment
- isContentFragment flagisArchive
- isArchive flagisSnippetTemplate
- isSnippetTemplate flagisDownloadable
- isDownloadable flagisOmniSearchRequest
- isOmniSearchRequest flagisStockAsset
- isStockAsset flagisStockAssetLicensed
- isStockAssetLicensed flagisStockAccessible
- isStockAccessible flagisLiveCopy
- isLiveCopy flag@Deprecated public static java.util.List<java.lang.String> getDirectoryActionRels(boolean hasJcrRead, boolean hasModifyAccessControl, boolean hasJcrWrite, boolean hasReplicate, boolean isMACShared, boolean isCCShared, boolean isRootMACShared, boolean isMPShared, boolean isRootMPShared, boolean isLiveCopy)
getDirectoryActionRels(boolean, boolean, boolean, boolean, boolean,
boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean)
hasJcrRead
- hasJcrRead flaghasModifyAccessControl
- hasModifyAccessControl flaghasJcrWrite
- hasJcrWrite flaghasReplicate
- hasReplicate flagisMACShared
- isMACShared flagisCCShared
- isCCShared flagisRootMACShared
- isRootMACShared flagisMPShared
- isMPShared flagisRootMPShared
- isRootMPShared flagisLiveCopy
- isLiveCopy flagpublic static java.util.List<java.lang.String> getDirectoryActionRels(boolean hasJcrRead, boolean hasModifyAccessControl, boolean hasJcrWrite, boolean hasReplicate, boolean isMACShared, boolean isCCShared, boolean isRootMACShared, boolean isMPShared, boolean isRootMPShared, boolean isLiveCopy, boolean hasAddChild, boolean hasRemoveNode, boolean hasModifyProperties)
hasJcrRead
- hasJcrRead flaghasModifyAccessControl
- hasModifyAccessControl flaghasJcrWrite
- hasJcrWrite flaghasReplicate
- hasReplicate flagisMACShared
- isMACShared flagisCCShared
- isCCShared flagisRootMACShared
- isRootMACShared flagisMPShared
- isMPShared flagisRootMPShared
- isRootMPShared flagisLiveCopy
- isLiveCopy flaghasAddChild
- Indicates if jcr:addChildNodes permission is grantedhasRemoveNode
- Indicates if jcr:removeNode permission is grantedhasModifyProperties
- Indicates if jcr:modifyProperties permission is grantedCopyright © 2010 - 2020 Adobe. All Rights Reserved