public class UIHelper extends Object
Constructor and Description |
---|
UIHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canRenderOnWeb(String mimeType)
Returns true if the given mime type can be rendered in HTML by browser.
|
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 String |
getCheckedOutby(Asset asset) |
static Resource |
getCurrentSuffixResource(SlingHttpServletRequest request)
returns the resource represented by the suffix.
|
static int |
getHeight(Rendition r) |
static String |
getSizeLabel(double size)
Adds units to given size in bytes and create label to be displayed in UI
|
static 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 String |
getTitle(Resource res)
Returns the title of a resource.
|
static int |
getWidth(Rendition r)
Returns the width of rendition if follows the naming convention
cq5dam.[thumbnail|web].width.height.ext,else 0
|
static boolean |
hasPermission(AccessControlManager acm,
Resource res,
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(String mimetype)
returns whether Interactive Edit(crop/rotate) operations are supported on
the given mimetype
|
static String |
lookupMimeType(String mimeType,
Node node,
boolean uppercase) |
public static 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 long getCacheKiller(Node node)
node
- a nodepublic static Resource getCurrentSuffixResource(SlingHttpServletRequest request)
request
- sling requestpublic static String getSizeLabel(double size)
size
- size in bytespublic static String getSizeLabel(double size, SlingHttpServletRequest slingRequest)
size
- size in bytespublic static boolean hasPermission(AccessControlManager acm, Resource res, String privilege) throws RepositoryException
acm
- AccessControlManager to determine the permissionsres
- resourceprivilege
- action, wanted to perform on the resRepositoryException
public static boolean isEditSupportedFormat(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(String mimeType)
mimeType
- public static int getWidth(Rendition r)
r
- Rendition whose width is requiredpublic static int getHeight(Rendition r)
public static boolean isCheckedOutByDrive(Asset asset)
asset
- Asset whose status needs to be determined"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"