public class FMUtils
extends java.lang.Object
Constructor and Description |
---|
FMUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addMetaDataToCQPage(Resource cqPageResource,
ResourceResolver resourceResolver,
java.lang.String cqPagePath,
JSONObject metadataProperties,
FMConstants.CoreAssetType assetType,
java.lang.String templatePath) |
static void |
addMetaDataToGuideContainer(ResourceResolver resourceResolver,
java.lang.String cqPagePath,
JSONObject metadataProperties,
FMConstants.CoreAssetType assetType,
FMConstants.FORM_MODEL form_model) |
static void |
addMixin(Node node,
java.lang.String[] mixinNames)
This utility is to add mixinNames at node
|
static boolean |
canReplicate(java.lang.String path,
Session session) |
static boolean |
checkForExistingForms(java.lang.String assetPath,
Session session,
java.lang.String rootPath)
This API is used to parse through all the nodes in the hierarchy of the provided asset path and to check whether any of those nodes is an asset other than a folder.
|
static void |
cleanUpReplicationInfo(Session session,
java.lang.String path) |
static boolean |
clientlibExists(java.lang.String clientlibCategoryName,
HtmlLibraryManager htmlLibraryManager)
API checks whether given client lib category does exist across aem or not
|
static JSONObject |
convertSetOfFormInfoToJSONObject(java.util.Set<AssetInfo> formInfoList) |
static Node |
createCQPageNode(ResourceResolver resourceResolver,
JSONObject paramsJson,
FMConstants.CoreAssetType assetType,
FMConstants.FORM_MODEL form_model,
java.lang.String templatePath)
Create the Node hierarchy under FM_AF_ROOT and delete all the rootPanel item nodes.
|
static Resource |
createCQPageResource(ResourceResolver resourceResolver,
java.lang.String cqPagePath,
JSONObject metadataProperties,
FMConstants.CoreAssetType assetType,
FMConstants.FORM_MODEL form_model,
java.lang.String templatePath) |
static java.util.Map<java.lang.String,java.lang.String> |
createFormsetRenderURLParams(Node formNode,
java.lang.String type,
java.lang.String submitUrl,
java.lang.String profile,
java.lang.String sampleDataId,
Session session) |
static java.util.Map<java.lang.String,java.lang.String> |
createGuideRenderURL(Node guideNode,
java.lang.String sampleDataId,
Session session) |
static java.util.Map<java.lang.String,java.lang.String> |
createMulichannelDocumentRenderURL(Node assetNode,
java.lang.String sampleDataId,
Session session,
java.lang.String channelType) |
static void |
deleteTempArchives(Session session)
Deletes temp archives created in CRX during uploadForm.
|
static Node |
getAnalyticsDataNode(Node formNode,
boolean create) |
static java.lang.String |
getAssetPathFromPage(java.lang.String pagePath)
This function returns Asset path from Page path for Adaptive Pages
ie : Guide, AF Fragment, Adaptive Document
|
static FMConstants.CoreAssetType |
getAssetType(Session session,
java.lang.String nodePath) |
static byte[] |
getBytesFromInputStream(java.io.InputStream oInpStream) |
static java.lang.String |
getCategoryNameFromClientLibPath(java.lang.String clientLibPath)
This API generates Category name from the theme clientlib path by appending relative path directory names separated by '.'
|
static java.lang.String |
getClientlibPath(Node resourceNode)
getClientlibPath
This API is used to fetch client lib path by appending client lib location and asset name
|
static Resource |
getClosestNodeUpInHierarchy(ResourceResolver resolver,
java.lang.String path,
java.lang.String inputPropertyName,
java.lang.String inputPropertyValue,
boolean includeCurrentNode)
This function returns first node resource encountered up in the hierarchy that has given property value of the given property name.
|
static Node |
getContentNode(Node formNode,
boolean create) |
static java.lang.String |
getDescription(Resource resource)
This API returns description of an Asset.
|
static java.lang.String |
getDisplayType(Resource resource)
This API returns display type of an Asset.
|
static java.lang.String |
getDocumentPagePath(java.lang.String channelPath)
Returns the Document page path
|
static java.lang.String |
getDORRefPath(Session session,
java.lang.String guidePath) |
static ResourceResolver |
getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory)
This function returns the resource resolver for fd-service system user.
|
static Session |
getFnDServiceUserSession(SlingRepository repository)
This function returns the session for fd-service system user.
|
static Node |
getFolderNode(Session session,
java.lang.String rootNodePath,
boolean create,
java.lang.String folderType) |
static FormsAssetType |
getFormsFoundationAssetType(FMConstants.CoreAssetType coreAssetType)
This utility is to return Forms Foundation Asset Type deduced from Forms Manager Asset Type.
|
static FormsMgrException |
getFormsMgrException(java.lang.Exception e) |
static java.lang.String |
getFormType(FMConstants.CoreAssetType assetType) |
static long |
getLastModified(Resource resource)
This API returns last modified time of an Asset.
|
static long |
getLastModifiedOrCreated(Session session,
java.lang.String assetPath) |
static Node |
getMetadataNode(Node formNode,
boolean create) |
static Node |
getMetadataNode(Session session,
java.lang.String formPath,
boolean create) |
static java.lang.String |
getMetaTemplateRefPath(Session session,
java.lang.String guidePath) |
static java.lang.String |
getNameFromPath(java.lang.String path) |
static Property |
getNodeProperty(java.lang.String propertyName,
Node node) |
static java.lang.String |
getPagePathFromAsset(java.lang.String assetPath)
This function returns Page path from Asset path for Adaptive Assets
ie : Guide, AF Fragment, Adaptive Document, Multichannel Document
|
static Resource |
getPrintChannelResource(Resource resource) |
static java.lang.String |
getPropertyAsString(Session session,
java.lang.String nodePath,
java.lang.String propertyName) |
static Node |
getRenditionNode(Node formNode,
boolean create) |
static java.lang.String |
getRequestParamValue(RequestParameterMap paramMap,
java.lang.String param)
This function retrieves string value of a request parameter.
|
static ResourceResolver |
getResourceResolver(ResourceResolverFactory resourceResolverFactory,
Session session) |
static java.lang.String |
getResourceTitle(Resource resource) |
static java.lang.String |
getRootLevelAssetType(Session session,
java.lang.String assetPath)
This method is used to deduce the type of the root level folder in which the asset with the specified asset path lies.
|
static java.lang.String |
getSchemaRefPath(Session session,
java.lang.String guidePath) |
static long |
getSize(Resource resource)
This API returns size of Asset.
|
static java.lang.String |
getStatus(Resource resource)
This API returns current status of an Asset.
|
static java.lang.String |
getThemeRef(Session session,
java.lang.String path) |
static java.lang.String |
getTitle(Resource resource)
This API returns title of an asset.
|
static Template |
getValidAFTemplate(ResourceResolver resourceResolver,
java.lang.String afTemplatePath,
java.lang.String assetPathSuffix)
Returns a Template object for the AF template path provided.
|
static java.lang.String |
getXDPRefPath(Session session,
java.lang.String guidePath) |
static java.lang.String |
getXSDRefPath(Session session,
java.lang.String guidePath) |
static void |
handleViewPrintNodeForDOR(java.lang.String dorType,
Resource guideContainerResource) |
static boolean |
hasDORTemplate(Session session,
java.lang.String path) |
static boolean |
hasMetaTemplate(Session session,
java.lang.String path) |
static boolean |
hasMixin(Node node,
java.lang.String mixinName)
This utility is to check whether mixinName exists at node or not
|
static boolean |
hasProperty(Session session,
java.lang.String path,
java.lang.String propertyName) |
static boolean |
hasSchemaRef(Session session,
java.lang.String path) |
static boolean |
hasXSDRef(Session session,
java.lang.String path) |
static boolean |
isAdaptiveDocument(Session session,
java.lang.String path) |
static boolean |
isAFFragment(Session session,
java.lang.String path) |
static boolean |
isApplication(Session session,
java.lang.String path) |
static boolean |
isDocumentChannel(ResourceResolver resourceResolver,
java.lang.String path)
Returns whether a cq:Page is a Document channel or not
|
static boolean |
isFDM(Session session,
java.lang.String path) |
static boolean |
isFolder(Session session,
java.lang.String path) |
static boolean |
isForm(FMConstants.CoreAssetType assetType) |
static boolean |
isFormset(Session session,
java.lang.String path) |
static boolean |
isGuide(Session session,
java.lang.String path) |
static boolean |
isMultichannelDocument(Session session,
java.lang.String path) |
static boolean |
isPDFForm(Session session,
java.lang.String path) |
static boolean |
isPrintForm(Session session,
java.lang.String path) |
static boolean |
isResource(Session session,
java.lang.String path) |
static boolean |
isTheme(Session session,
java.lang.String path) |
static boolean |
isThemeClientLib(Node assetNode) |
static boolean |
isUserPartOfGroup(java.security.Principal userPrincipal,
UserManager um,
java.lang.String groupId)
Returns true if given userPrincipal is part of group
|
static boolean |
isValidAssetName(java.lang.String assetName,
java.lang.String pattern) |
static boolean |
isValidFolderName(java.lang.String folderName) |
static boolean |
isXDPForm(Session session,
java.lang.String path) |
static boolean |
isXFABasedForm(Session session,
java.lang.String path) |
static void |
JsonToJcrNode(Node node,
JSONObject jsonObject)
Method to create jcr nodes from json.
|
static void |
moveNode(ResourceResolver resolver,
java.lang.String sourceLocation,
java.lang.String destinationLocation)
This API is used to move node from source location to destination location
|
static <T> T |
notNulOrDefault(T getValue,
T defaultValue) |
static void |
prepareJsonToCreateDAMAsset(ResourceResolver resourceResolver,
JSONObject inOutAssetJSON,
FMConstants.CoreAssetType assetType,
java.lang.String formPath,
java.lang.String formName)
Method to return DAM Asset json structure.
|
static void |
setAssetIdentifier(Node node,
java.lang.String assetType,
int validOrdinal)
This API sets the identifier at node.
|
static void |
setLastModifiedTime(java.lang.String formPath,
ResourceResolver resolver) |
static void |
unscheduleJob(JobManager jobManager,
java.lang.String formPath,
java.lang.String replicationAtribute) |
static void |
writeRequestStatusSuccess(SlingHttpServletResponse resp,
boolean isIE) |
public static Node getMetadataNode(Node formNode, boolean create) throws FormsMgrException
FormsMgrException
public static Node getMetadataNode(Session session, java.lang.String formPath, boolean create) throws FormsMgrException
FormsMgrException
public static Node getAnalyticsDataNode(Node formNode, boolean create) throws FormsMgrException
FormsMgrException
public static Node getContentNode(Node formNode, boolean create) throws FormsMgrException
FormsMgrException
public static boolean isFolder(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isApplication(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isXDPForm(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isResource(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isGuide(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isPDFForm(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isPrintForm(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isFormset(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isAFFragment(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isAdaptiveDocument(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isTheme(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isThemeClientLib(Node assetNode) throws FormsMgrException
assetNode
- a non null nodeFormsMgrException
public static boolean isFDM(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isMultichannelDocument(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isDocumentChannel(@Nonnull ResourceResolver resourceResolver, java.lang.String path)
resourceResolver
- path
- Path to the Channel cq:Pagepublic static java.lang.String getDocumentPagePath(java.lang.String channelPath)
channelPath
- Path to the Channel cq:Pagepublic static boolean isXFABasedForm(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean hasDORTemplate(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean hasMetaTemplate(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean hasXSDRef(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean hasSchemaRef(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean hasProperty(Session session, java.lang.String path, java.lang.String propertyName) throws FormsMgrException
FormsMgrException
public static Property getNodeProperty(java.lang.String propertyName, Node node) throws FormsMgrException
FormsMgrException
public static java.lang.String getXDPRefPath(Session session, java.lang.String guidePath) throws FormsMgrException
FormsMgrException
public static java.lang.String getDORRefPath(Session session, java.lang.String guidePath) throws FormsMgrException
FormsMgrException
public static java.lang.String getMetaTemplateRefPath(Session session, java.lang.String guidePath) throws FormsMgrException
FormsMgrException
public static java.lang.String getXSDRefPath(Session session, java.lang.String guidePath) throws FormsMgrException
FormsMgrException
public static java.lang.String getSchemaRefPath(Session session, java.lang.String guidePath) throws FormsMgrException
FormsMgrException
public static java.util.Map<java.lang.String,java.lang.String> createGuideRenderURL(Node guideNode, java.lang.String sampleDataId, Session session) throws FormsMgrException
FormsMgrException
public static java.util.Map<java.lang.String,java.lang.String> createMulichannelDocumentRenderURL(Node assetNode, java.lang.String sampleDataId, Session session, java.lang.String channelType) throws FormsMgrException
FormsMgrException
public static java.util.Map<java.lang.String,java.lang.String> createFormsetRenderURLParams(Node formNode, java.lang.String type, java.lang.String submitUrl, java.lang.String profile, java.lang.String sampleDataId, Session session) throws FormsMgrException
FormsMgrException
public static boolean isForm(FMConstants.CoreAssetType assetType)
public static java.lang.String getFormType(FMConstants.CoreAssetType assetType)
public static void deleteTempArchives(Session session) throws FormsMgrException
session
- - Session sessionFormsMgrException
public static ResourceResolver getResourceResolver(ResourceResolverFactory resourceResolverFactory, Session session) throws FormsMgrException
FormsMgrException
public static void writeRequestStatusSuccess(SlingHttpServletResponse resp, boolean isIE) throws java.io.IOException, JSONException
java.io.IOException
JSONException
public static Node getFolderNode(Session session, java.lang.String rootNodePath, boolean create, java.lang.String folderType) throws FormsMgrException
FormsMgrException
public static java.lang.String getPagePathFromAsset(java.lang.String assetPath)
assetPath
- path of the assetpublic static java.lang.String getAssetPathFromPage(java.lang.String pagePath)
pagePath
- path of the assetpublic static Resource getClosestNodeUpInHierarchy(ResourceResolver resolver, java.lang.String path, java.lang.String inputPropertyName, java.lang.String inputPropertyValue, boolean includeCurrentNode) throws FormsMgrException
resolver
- path
- inputPropertyName
- inputPropertyValue
- includeCurrentNode
- FormsMgrException
public static long getLastModifiedOrCreated(Session session, java.lang.String assetPath) throws FormsMgrException
session
- assetPath
- FormsMgrException
- if cant get nodepublic static java.lang.String getNameFromPath(java.lang.String path) throws FormsMgrException
FormsMgrException
public static FMConstants.CoreAssetType getAssetType(Session session, java.lang.String nodePath) throws FormsMgrException
FormsMgrException
public static FormsMgrException getFormsMgrException(java.lang.Exception e)
public static void unscheduleJob(JobManager jobManager, java.lang.String formPath, java.lang.String replicationAtribute)
public static java.lang.String getRootLevelAssetType(Session session, java.lang.String assetPath) throws RepositoryException
session
- CRX session to be usedassetPath
- Path of the asset for which to deduce which type of root folder it belongs to.RepositoryException
public static byte[] getBytesFromInputStream(java.io.InputStream oInpStream) throws java.io.IOException
java.io.IOException
public static Session getFnDServiceUserSession(SlingRepository repository) throws RepositoryException
repository
- RepositoryException
public static ResourceResolver getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory) throws LoginException
resourceResolverFactory
- RepositoryException
LoginException
public static JSONObject convertSetOfFormInfoToJSONObject(java.util.Set<AssetInfo> formInfoList) throws FormsMgrException
FormsMgrException
public static boolean canReplicate(java.lang.String path, Session session) throws RepositoryException
RepositoryException
public static void prepareJsonToCreateDAMAsset(ResourceResolver resourceResolver, JSONObject inOutAssetJSON, FMConstants.CoreAssetType assetType, java.lang.String formPath, java.lang.String formName) throws FormsMgrException
resourceResolver
- inOutAssetJSON
- assetType
- formPath
- formName
- FormsMgrException
public static Resource createCQPageResource(ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model, java.lang.String templatePath) throws FormsMgrException, RepositoryException, PersistenceException, JSONException
public static void addMetaDataToCQPage(Resource cqPageResource, ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, java.lang.String templatePath) throws JSONException
JSONException
public static void handleViewPrintNodeForDOR(java.lang.String dorType, Resource guideContainerResource)
public static void addMetaDataToGuideContainer(ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model) throws JSONException
JSONException
public static Node createCQPageNode(ResourceResolver resourceResolver, JSONObject paramsJson, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model, java.lang.String templatePath) throws FormsMgrException
resourceResolver
- paramsJson
- assetType
- form_model
- templatePath
- FormsMgrException
public static Template getValidAFTemplate(ResourceResolver resourceResolver, java.lang.String afTemplatePath, java.lang.String assetPathSuffix) throws RepositoryException
resourceResolver
- afTemplatePath
- RepositoryException
public static void JsonToJcrNode(Node node, JSONObject jsonObject) throws JSONException, RepositoryException
node
- - Json structure will be mapped under this node.jsonObject
- FormsMgrException
JSONException
RepositoryException
public static void moveNode(ResourceResolver resolver, java.lang.String sourceLocation, java.lang.String destinationLocation) throws FormsMgrException
resolver
- sourceLocation
- - it contains the location of node which is to be moveddestinationLocation
- - it contains the location where node is to be movedFormsMgrException
public static java.lang.String getClientlibPath(Node resourceNode) throws FormsMgrException
resourceNode
- FormsMgrException
public static java.lang.String getThemeRef(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static java.lang.String getPropertyAsString(Session session, java.lang.String nodePath, java.lang.String propertyName) throws FormsMgrException
FormsMgrException
public static java.lang.String getCategoryNameFromClientLibPath(java.lang.String clientLibPath)
clientLibPath
- public static Node getRenditionNode(Node formNode, boolean create) throws FormsMgrException
FormsMgrException
public static java.lang.String getResourceTitle(Resource resource) throws FormsMgrException
FormsMgrException
public static FormsAssetType getFormsFoundationAssetType(FMConstants.CoreAssetType coreAssetType) throws FormsMgrException
coreAssetType
- FormsMgrException
public static boolean hasMixin(Node node, java.lang.String mixinName) throws RepositoryException
node
- mixinName
- RepositoryException
public static void addMixin(Node node, java.lang.String[] mixinNames) throws FormsMgrException
node
- mixinNames
- FormsMgrException
public static void cleanUpReplicationInfo(Session session, java.lang.String path) throws FormsMgrException
FormsMgrException
public static boolean isValidAssetName(java.lang.String assetName, java.lang.String pattern)
public static boolean isValidFolderName(java.lang.String folderName)
public static boolean checkForExistingForms(java.lang.String assetPath, Session session, java.lang.String rootPath) throws FormsMgrException, RepositoryException
assetPath
- session
- rootPath
- FormsMgrException
RepositoryException
public static boolean isUserPartOfGroup(java.security.Principal userPrincipal, UserManager um, java.lang.String groupId) throws RepositoryException
userPrincipal
- um
- reference to UserManager serviceRepositoryException
public static void setLastModifiedTime(java.lang.String formPath, ResourceResolver resolver)
formPath
- dam asset path is expectedresolver
- resource resolverpublic static <T> T notNulOrDefault(T getValue, T defaultValue)
public static void setAssetIdentifier(Node node, java.lang.String assetType, int validOrdinal) throws FormsMgrException
node
- at which identifier is to be setassetType
- to be set as an identifierFormsMgrException
public static boolean clientlibExists(java.lang.String clientlibCategoryName, HtmlLibraryManager htmlLibraryManager)
clientlibCategoryName
- htmlLibraryManager
- public static java.lang.String getRequestParamValue(RequestParameterMap paramMap, java.lang.String param)
paramMap
- param
- public static java.lang.String getTitle(Resource resource)
resource
- public static java.lang.String getDisplayType(Resource resource)
resource
- public static long getSize(Resource resource)
resource
- public static java.lang.String getDescription(Resource resource)
resource
- public static java.lang.String getStatus(Resource resource)
resource
- public static long getLastModified(Resource resource)
resource
- public static Resource getPrintChannelResource(Resource resource) throws FormsMgrException
resource
- a multichhanel document asset resource residing under /content/dam/formsanddocuments/
It's the responsibility of the caller to make sure that the resource refers to a valid multichannel documentFormsMgrException
- if any exception occurs while trying to load the resource and its hierarchyCopyright © 2010 - 2020 Adobe. All Rights Reserved