Class FMUtils
- java.lang.Object
-
- com.adobe.aem.formsndocuments.util.FMUtils
-
public class FMUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FMUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddMetaDataToCQPage(Resource cqPageResource, ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, java.lang.String templatePath)static voidaddMetaDataToGuideContainer(ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model)static voidaddMixin(javax.jcr.Node node, java.lang.String[] mixinNames)This utility is to add mixinNames at nodestatic ModifiableValueMapaddSignEnabledFlag(JSONObject metadataProperties, ModifiableValueMap mvm)method to enable sign flag if sign is enabled in templatestatic booleancanReplicate(java.lang.String path, javax.jcr.Session session)static booleancheckForExistingForms(java.lang.String assetPath, javax.jcr.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 voidcleanUpReplicationInfo(javax.jcr.Session session, java.lang.String path)static booleanclientlibExists(java.lang.String clientlibCategoryName, HtmlLibraryManager htmlLibraryManager)API checks whether given client lib category does exist across aem or notstatic JSONObjectconvertSetOfFormInfoToJSONObject(java.util.Set<AssetInfo> formInfoList)static javax.jcr.NodecreateCQPageNode(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 ResourcecreateCQPageResource(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(javax.jcr.Node formNode, java.lang.String type, java.lang.String submitUrl, java.lang.String profile, java.lang.String sampleDataId, javax.jcr.Session session)static java.util.Map<java.lang.String,java.lang.String>createGuideRenderURL(javax.jcr.Node guideNode, java.lang.String sampleDataId, javax.jcr.Session session)static java.util.Map<java.lang.String,java.lang.String>createMulichannelDocumentRenderURL(javax.jcr.Node assetNode, java.lang.String sampleDataId, javax.jcr.Session session, java.lang.String channelType)static voiddeleteTempArchives(javax.jcr.Session session)Deletes temp archives created in CRX during uploadForm.static javax.jcr.NodegetAnalyticsDataNode(javax.jcr.Node formNode, boolean create)static java.lang.StringgetAssetPathFromPage(java.lang.String pagePath)This function returns Asset path from Page path for Adaptive Pages ie : Guide, AF Fragment, Adaptive Documentstatic FMConstants.CoreAssetTypegetAssetType(javax.jcr.Session session, java.lang.String nodePath)static byte[]getBytesFromInputStream(java.io.InputStream oInpStream)static java.lang.StringgetCategoryNameFromClientLibPath(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.StringgetClientlibPath(javax.jcr.Node resourceNode)getClientlibPath This API is used to fetch client lib path by appending client lib location and asset namestatic ResourcegetClosestNodeUpInHierarchy(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 javax.jcr.NodegetContentNode(javax.jcr.Node formNode, boolean create)static ResourcegetContentNode(Resource resource)static longgetCreated(javax.jcr.Session session, java.lang.String assetPath)static longgetCreatedPropertyOnNode(javax.jcr.Node node)static java.lang.StringgetCreatorTool(javax.jcr.Session session, java.lang.String path)static java.lang.StringgetDescription(Resource resource)This API returns description of an Asset.static java.lang.StringgetDisplayType(Resource resource)This API returns display type of an Asset.static java.lang.StringgetDocumentPagePath(java.lang.String channelPath)Returns the Document page pathstatic java.lang.StringgetDORRefPath(javax.jcr.Session session, java.lang.String guidePath)static ResourcegetFMResourceFromAF(Resource adaptiveForm)static ResourceResolvergetFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory)This function returns the resource resolver for fd-service system user.static ResourceResolvergetFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory, java.lang.String subServiceName)This function returns the resource resolver for user mapped for provided subServiceName.static javax.jcr.SessiongetFnDServiceUserSession(SlingRepository repository)This function returns the session for fd-service system user.static javax.jcr.NodegetFolderNode(javax.jcr.Session session, java.lang.String rootNodePath, boolean create, java.lang.String folderType)static byte[]getFormBytes(javax.jcr.Session session, java.lang.String formPath)This API fetches form binaries stored as jcr data at rendition content nodestatic FormsAssetTypegetFormsFoundationAssetType(FMConstants.CoreAssetType coreAssetType)This utility is to return Forms Foundation Asset Type deduced from Forms Manager Asset Type.static FormsMgrExceptiongetFormsMgrException(java.lang.Exception e)static java.lang.StringgetFormType(FMConstants.CoreAssetType assetType)static longgetLastModified(Resource resource)This API returns last modified time of an Asset.static longgetLastModifiedOrCreated(javax.jcr.Session session, java.lang.String assetPath)static longgetLastUpdatedPropertyOnNode(javax.jcr.Node node)static javax.jcr.NodegetMetadataNode(javax.jcr.Node formNode, boolean create)static javax.jcr.NodegetMetadataNode(javax.jcr.Session session, java.lang.String formPath, boolean create)static java.lang.StringgetMetaTemplateRefPath(javax.jcr.Session session, java.lang.String guidePath)static java.lang.StringgetNameFromPath(java.lang.String path)static javax.jcr.PropertygetNodeProperty(java.lang.String propertyName, javax.jcr.Node node)static javax.jcr.NodegetOriginalRenditionNode(javax.jcr.Node formNode, boolean create)This API returns original rendition node of given node.static java.lang.StringgetPagePathFromAsset(java.lang.String assetPath)This function returns Page path from Asset path for Adaptive Assets ie : Guide, AF Fragment, Adaptive Document, Multichannel Documentstatic ResourcegetPrintChannelResource(Resource resource)static ResourcegetProbableDamAssetForRendition(Resource rendition)climbs back up to the damAsset resourcestatic java.lang.StringgetPropertyAsString(javax.jcr.Session session, java.lang.String nodePath, java.lang.String propertyName)static javax.jcr.NodegetRenditionNode(javax.jcr.Node formNode, boolean create)static java.lang.StringgetRequestParamValue(RequestParameterMap paramMap, java.lang.String param)This function retrieves string value of a request parameter.static ResourceResolvergetResourceResolver(ResourceResolverFactory resourceResolverFactory, javax.jcr.Session session)static java.lang.StringgetResourceTitle(Resource resource)static java.lang.StringgetRootLevelAssetType(javax.jcr.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.StringgetSchemaRefPath(javax.jcr.Session session, java.lang.String guidePath)static longgetSize(Resource resource)This API returns size of Asset.static java.lang.StringgetStatus(Resource resource)This API returns current status of an Asset.static java.lang.StringgetSupportedLanguage(java.util.Locale locale, GuideLocalizationService localizationService)static java.lang.StringgetThemeRef(javax.jcr.Session session, java.lang.String path)static java.lang.StringgetTitle(Resource resource)This API returns title of an asset.static TemplategetValidAFTemplate(ResourceResolver resourceResolver, java.lang.String afTemplatePath, java.lang.String assetPathSuffix)Returns a Template object for the AF template path provided.static java.lang.StringgetXDPRefPath(javax.jcr.Session session, java.lang.String guidePath)static java.lang.StringgetXSDRefPath(javax.jcr.Session session, java.lang.String guidePath)static voidhandleViewPrintNodeForDOR(java.lang.String dorType, Resource guideContainerResource)static booleanhasDORTemplate(javax.jcr.Session session, java.lang.String path)static booleanhasMetaTemplate(javax.jcr.Session session, java.lang.String path)static booleanhasMixin(javax.jcr.Node node, java.lang.String mixinName)This utility is to check whether mixinName exists at node or notstatic booleanhasProperty(javax.jcr.Session session, java.lang.String path, java.lang.String propertyName)static booleanhasSchemaRef(javax.jcr.Session session, java.lang.String path)static booleanhasXSDRef(javax.jcr.Session session, java.lang.String path)static booleanisAdaptiveDocument(javax.jcr.Session session, java.lang.String path)static booleanisAdaptiveForm(Resource resource)static booleanisAF2(java.lang.String version)Check if fd:version value belongs to AF2 spec versionsstatic booleanisAF2WithCoreComponent(java.lang.String version)Check if fd:version value belongs to AF2 Form container core component (v2)static booleanisAF2WithHeadlessComponent(java.lang.String version)Check if fd:version value belongs to AF2 Form container headless component (v1)static booleanisAFFragment(javax.jcr.Session session, java.lang.String path)static booleanisApplication(javax.jcr.Session session, java.lang.String path)static booleanisDocumentChannel(ResourceResolver resourceResolver, java.lang.String path)Returns whether a cq:Page is a Document channel or notstatic booleanisDORResolutionRequest(Resource resource, java.util.Set supportedLocales)static booleanisFDM(javax.jcr.Session session, java.lang.String path)static booleanisFolder(javax.jcr.Session session, java.lang.String path)static booleanisForm(FMConstants.CoreAssetType assetType)static booleanisFormset(javax.jcr.Session session, java.lang.String path)static booleanisGuide(javax.jcr.Session session, java.lang.String path)static booleanisImmutablePath(java.lang.String path)static booleanisMultichannelDocument(javax.jcr.Session session, java.lang.String path)static booleanisPDFForm(javax.jcr.Session session, java.lang.String path)static booleanisPreAF2(java.lang.String version)Check if fd:version value belongs to pre AF2 spec versionsstatic booleanisPrintForm(javax.jcr.Session session, java.lang.String path)static booleanisPropertyProtected(javax.jcr.Node node, java.lang.String propertyName)Checks if a property is protected on a given node.static booleanisResource(javax.jcr.Session session, java.lang.String path)static booleanisTheme(javax.jcr.Session session, java.lang.String path)static booleanisThemeClientLib(javax.jcr.Node assetNode)static booleanisUserPartOfGroup(java.security.Principal userPrincipal, UserManager um, java.lang.String groupId)Returns true if given userPrincipal is part of groupstatic booleanisValidAssetName(java.lang.String assetName, java.lang.String pattern)static booleanisValidFolderName(java.lang.String folderName)static booleanisValidXDPResolutionRequest(Resource resource)static booleanisValidXFSResolutionRequest(Resource resource)static booleanisVersionMatches(java.lang.String versionToBeMatched, java.lang.String[] versions)Match a version against a list of versionsstatic booleanisXDPForm(javax.jcr.Session session, java.lang.String path)static booleanisXFABasedForm(javax.jcr.Session session, java.lang.String path)static voidJsonToJcrNode(javax.jcr.Node node, JSONObject jsonObject)Method to create jcr nodes from json.static voidmakeNodeTrusted(javax.jcr.Node node, boolean isTrusted)static voidmoveNode(ResourceResolver resolver, java.lang.String sourceLocation, java.lang.String destinationLocation)This API is used to move node from source location to destination locationstatic <T> TnotNulOrDefault(T getValue, T defaultValue)static voidprepareJsonToCreateDAMAsset(ResourceResolver resourceResolver, JSONObject inOutAssetJSON, FMConstants.CoreAssetType assetType, java.lang.String formPath, java.lang.String formName)Method to return DAM Asset json structure.static voidremoveAllMixinTypes(javax.jcr.Node node)static voidsetAssetIdentifier(javax.jcr.Node node, java.lang.String assetType, int validOrdinal)This API sets the identifier at node.static voidsetLastModifiedTime(java.lang.String formPath, ResourceResolver resolver)static voidunscheduleJob(JobManager jobManager, java.lang.String formPath, java.lang.String replicationAtribute)static voidwriteRequestStatusSuccess(SlingHttpServletResponse resp, boolean isIE)
-
-
-
Method Detail
-
getMetadataNode
public static javax.jcr.Node getMetadataNode(javax.jcr.Node formNode, boolean create) throws FormsMgrException- Throws:
FormsMgrException
-
getMetadataNode
public static javax.jcr.Node getMetadataNode(javax.jcr.Session session, java.lang.String formPath, boolean create) throws FormsMgrException- Throws:
FormsMgrException
-
getAnalyticsDataNode
public static javax.jcr.Node getAnalyticsDataNode(javax.jcr.Node formNode, boolean create) throws FormsMgrException- Throws:
FormsMgrException
-
getContentNode
public static javax.jcr.Node getContentNode(javax.jcr.Node formNode, boolean create) throws FormsMgrException- Throws:
FormsMgrException
-
isFolder
public static boolean isFolder(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isApplication
public static boolean isApplication(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isAdaptiveForm
public static boolean isAdaptiveForm(Resource resource)
-
isXDPForm
public static boolean isXDPForm(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isResource
public static boolean isResource(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isGuide
public static boolean isGuide(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isPDFForm
public static boolean isPDFForm(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isPrintForm
public static boolean isPrintForm(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isFormset
public static boolean isFormset(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isAFFragment
public static boolean isAFFragment(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isAdaptiveDocument
public static boolean isAdaptiveDocument(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isTheme
public static boolean isTheme(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isThemeClientLib
public static boolean isThemeClientLib(javax.jcr.Node assetNode) throws FormsMgrException- Parameters:
assetNode- a non null node- Returns:
- true if the given node is of type FMConstants.CQ_CLIENTLIBRARY_FOLDER and FMConstants.GUIDE_COMPONENT_TYPE property's value is FMConstants.THEME_GUIDE_COMPONENT_TYPE_VALUE. false otherwise
- Throws:
FormsMgrException
-
isFDM
public static boolean isFDM(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isMultichannelDocument
public static boolean isMultichannelDocument(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isDocumentChannel
public static boolean isDocumentChannel(@Nonnull ResourceResolver resourceResolver, java.lang.String path)Returns whether a cq:Page is a Document channel or not- Parameters:
resourceResolver-path- Path to the Channel cq:Page- Returns:
-
getDocumentPagePath
public static java.lang.String getDocumentPagePath(java.lang.String channelPath)
Returns the Document page path- Parameters:
channelPath- Path to the Channel cq:Page- Returns:
-
isXFABasedForm
public static boolean isXFABasedForm(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
hasDORTemplate
public static boolean hasDORTemplate(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
hasMetaTemplate
public static boolean hasMetaTemplate(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
hasXSDRef
public static boolean hasXSDRef(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
hasSchemaRef
public static boolean hasSchemaRef(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
hasProperty
public static boolean hasProperty(javax.jcr.Session session, java.lang.String path, java.lang.String propertyName) throws FormsMgrException- Throws:
FormsMgrException
-
getNodeProperty
public static javax.jcr.Property getNodeProperty(java.lang.String propertyName, javax.jcr.Node node) throws FormsMgrException- Throws:
FormsMgrException
-
getXDPRefPath
public static java.lang.String getXDPRefPath(javax.jcr.Session session, java.lang.String guidePath) throws FormsMgrException- Throws:
FormsMgrException
-
getDORRefPath
public static java.lang.String getDORRefPath(javax.jcr.Session session, java.lang.String guidePath) throws FormsMgrException- Throws:
FormsMgrException
-
getMetaTemplateRefPath
public static java.lang.String getMetaTemplateRefPath(javax.jcr.Session session, java.lang.String guidePath) throws FormsMgrException- Throws:
FormsMgrException
-
getXSDRefPath
public static java.lang.String getXSDRefPath(javax.jcr.Session session, java.lang.String guidePath) throws FormsMgrException- Throws:
FormsMgrException
-
getSchemaRefPath
public static java.lang.String getSchemaRefPath(javax.jcr.Session session, java.lang.String guidePath) throws FormsMgrException- Throws:
FormsMgrException
-
createGuideRenderURL
public static java.util.Map<java.lang.String,java.lang.String> createGuideRenderURL(javax.jcr.Node guideNode, java.lang.String sampleDataId, javax.jcr.Session session) throws FormsMgrException- Throws:
FormsMgrException
-
createMulichannelDocumentRenderURL
public static java.util.Map<java.lang.String,java.lang.String> createMulichannelDocumentRenderURL(javax.jcr.Node assetNode, java.lang.String sampleDataId, javax.jcr.Session session, java.lang.String channelType) throws FormsMgrException- Throws:
FormsMgrException
-
createFormsetRenderURLParams
public static java.util.Map<java.lang.String,java.lang.String> createFormsetRenderURLParams(javax.jcr.Node formNode, java.lang.String type, java.lang.String submitUrl, java.lang.String profile, java.lang.String sampleDataId, javax.jcr.Session session) throws FormsMgrException- Throws:
FormsMgrException
-
isForm
public static boolean isForm(FMConstants.CoreAssetType assetType)
-
getFormType
public static java.lang.String getFormType(FMConstants.CoreAssetType assetType)
-
deleteTempArchives
public static void deleteTempArchives(javax.jcr.Session session) throws FormsMgrExceptionDeletes temp archives created in CRX during uploadForm. If a temp archive remains in the repository for more than a certain duration, the DeleteTempArchiveScheduler will call this function and delete it.- Parameters:
session- - Session session- Throws:
FormsMgrException
-
getResourceResolver
public static ResourceResolver getResourceResolver(ResourceResolverFactory resourceResolverFactory, javax.jcr.Session session) throws FormsMgrException
- Throws:
FormsMgrException
-
writeRequestStatusSuccess
public static void writeRequestStatusSuccess(SlingHttpServletResponse resp, boolean isIE) throws java.io.IOException, JSONException
- Throws:
java.io.IOExceptionJSONException
-
getFolderNode
public static javax.jcr.Node getFolderNode(javax.jcr.Session session, java.lang.String rootNodePath, boolean create, java.lang.String folderType) throws FormsMgrException- Throws:
FormsMgrException
-
getPagePathFromAsset
public 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- Parameters:
assetPath- path of the asset
-
getAssetPathFromPage
public 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- Parameters:
pagePath- path of the asset
-
getClosestNodeUpInHierarchy
public static Resource getClosestNodeUpInHierarchy(ResourceResolver resolver, java.lang.String path, java.lang.String inputPropertyName, java.lang.String inputPropertyValue, boolean includeCurrentNode) throws FormsMgrException
This function returns first node resource encountered up in the hierarchy that has given property value of the given property name.- Parameters:
resolver-path-inputPropertyName-inputPropertyValue-includeCurrentNode-- Throws:
FormsMgrException
-
getLastModifiedOrCreated
public static long getLastModifiedOrCreated(javax.jcr.Session session, java.lang.String assetPath) throws FormsMgrException- Parameters:
session-assetPath-- Returns:
- lastmodified time or created time or -1 if cant read property, but node exists
- Throws:
FormsMgrException- if cant get node
-
getCreated
public static long getCreated(javax.jcr.Session session, java.lang.String assetPath) throws FormsMgrException- Throws:
FormsMgrException
-
getLastUpdatedPropertyOnNode
public static long getLastUpdatedPropertyOnNode(javax.jcr.Node node) throws java.lang.NullPointerException, javax.jcr.RepositoryException- Throws:
java.lang.NullPointerExceptionjavax.jcr.RepositoryException
-
getCreatedPropertyOnNode
public static long getCreatedPropertyOnNode(javax.jcr.Node node) throws java.lang.NullPointerException, javax.jcr.RepositoryException- Throws:
java.lang.NullPointerExceptionjavax.jcr.RepositoryException
-
getNameFromPath
public static java.lang.String getNameFromPath(java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
getAssetType
public static FMConstants.CoreAssetType getAssetType(javax.jcr.Session session, java.lang.String nodePath) throws FormsMgrException
- Throws:
FormsMgrException
-
getFormsMgrException
public static FormsMgrException getFormsMgrException(java.lang.Exception e)
-
unscheduleJob
public static void unscheduleJob(JobManager jobManager, java.lang.String formPath, java.lang.String replicationAtribute)
-
getRootLevelAssetType
public static java.lang.String getRootLevelAssetType(javax.jcr.Session session, java.lang.String assetPath) throws javax.jcr.RepositoryExceptionThis method is used to deduce the type of the root level folder in which the asset with the specified asset path lies. It will return 'lcApplication' if asset lies inside an LC Application, 'lcFolder' if inside a general folder, its asset type if the asset lies in the shadow root node and null if the asset does not exist or if the path is of the shadow root node itself.- Parameters:
session- CRX session to be usedassetPath- Path of the asset for which to deduce which type of root folder it belongs to.- Throws:
javax.jcr.RepositoryException
-
getBytesFromInputStream
public static byte[] getBytesFromInputStream(java.io.InputStream oInpStream) throws java.io.IOException- Throws:
java.io.IOException
-
getFnDServiceUserSession
public static javax.jcr.Session getFnDServiceUserSession(SlingRepository repository) throws javax.jcr.RepositoryException
This function returns the session for fd-service system user.- Parameters:
repository-- Returns:
- fnd-service system user session
- Throws:
javax.jcr.RepositoryException
-
getFnDServiceUserResourceResolver
public static ResourceResolver getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory) throws LoginException
This function returns the resource resolver for fd-service system user.- Parameters:
resourceResolverFactory-- Returns:
- fnd-service system user resource resolver
- Throws:
javax.jcr.RepositoryExceptionLoginException
-
getFnDServiceUserResourceResolver
public static ResourceResolver getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory, java.lang.String subServiceName) throws LoginException
This function returns the resource resolver for user mapped for provided subServiceName.- Parameters:
resourceResolverFactory-subServiceName-- Returns:
- resource resolver for user mapped for provided subServiceName
- Throws:
LoginException
-
convertSetOfFormInfoToJSONObject
public static JSONObject convertSetOfFormInfoToJSONObject(java.util.Set<AssetInfo> formInfoList) throws FormsMgrException
- Throws:
FormsMgrException
-
canReplicate
public static boolean canReplicate(java.lang.String path, javax.jcr.Session session) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
prepareJsonToCreateDAMAsset
public static void prepareJsonToCreateDAMAsset(ResourceResolver resourceResolver, JSONObject inOutAssetJSON, FMConstants.CoreAssetType assetType, java.lang.String formPath, java.lang.String formName) throws FormsMgrException
Method to return DAM Asset json structure. This Json can be used with createAsset() API of FMCRUDService to create Asset. Session is not saved by this method.- Parameters:
resourceResolver-inOutAssetJSON-assetType-formPath-formName-- Throws:
FormsMgrException
-
createCQPageResource
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, javax.jcr.RepositoryException, PersistenceException, JSONException
- Throws:
FormsMgrExceptionjavax.jcr.RepositoryExceptionPersistenceExceptionJSONException
-
addMetaDataToCQPage
public static void addMetaDataToCQPage(Resource cqPageResource, ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, java.lang.String templatePath) throws JSONException
- Throws:
JSONException
-
removeAllMixinTypes
public static void removeAllMixinTypes(javax.jcr.Node node)
-
handleViewPrintNodeForDOR
public static void handleViewPrintNodeForDOR(java.lang.String dorType, Resource guideContainerResource)
-
addMetaDataToGuideContainer
public static void addMetaDataToGuideContainer(ResourceResolver resourceResolver, java.lang.String cqPagePath, JSONObject metadataProperties, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model) throws JSONException
- Throws:
JSONException
-
addSignEnabledFlag
public static ModifiableValueMap addSignEnabledFlag(JSONObject metadataProperties, ModifiableValueMap mvm)
method to enable sign flag if sign is enabled in template- Parameters:
metadataProperties-mvm-- Returns:
-
createCQPageNode
public static javax.jcr.Node createCQPageNode(ResourceResolver resourceResolver, JSONObject paramsJson, FMConstants.CoreAssetType assetType, FMConstants.FORM_MODEL form_model, java.lang.String templatePath) throws FormsMgrException
Create the Node hierarchy under FM_AF_ROOT and delete all the rootPanel item nodes. Session is not saved by this method.- Parameters:
resourceResolver-paramsJson-assetType-form_model-templatePath-- Returns:
- cqPageNode
- Throws:
FormsMgrException
-
getValidAFTemplate
public static Template getValidAFTemplate(ResourceResolver resourceResolver, java.lang.String afTemplatePath, java.lang.String assetPathSuffix) throws javax.jcr.RepositoryException
Returns a Template object for the AF template path provided. Returns null if the template path is invalid.- Parameters:
resourceResolver-afTemplatePath-- Returns:
- Template
- Throws:
javax.jcr.RepositoryException
-
JsonToJcrNode
public static void JsonToJcrNode(javax.jcr.Node node, JSONObject jsonObject) throws JSONException, javax.jcr.RepositoryExceptionMethod to create jcr nodes from json. This behaves similar to sling post but doesn't include all the node types. Session is not saved by this method. jcr:mixinTypes property - it is skipped, if found, while setting properties on node. nt:File node - It is skipped(not added), if found, while adding nodes.- Parameters:
node- - Json structure will be mapped under this node.jsonObject-- Throws:
FormsMgrExceptionJSONExceptionjavax.jcr.RepositoryException
-
moveNode
public static void moveNode(ResourceResolver resolver, java.lang.String sourceLocation, java.lang.String destinationLocation) throws FormsMgrException
This API is used to move node from source location to destination location- Parameters:
resolver-sourceLocation- - it contains the location of node which is to be moveddestinationLocation- - it contains the location where node is to be moved- Throws:
FormsMgrException
-
getClientlibPath
public static java.lang.String getClientlibPath(javax.jcr.Node resourceNode) throws FormsMgrExceptiongetClientlibPath This API is used to fetch client lib path by appending client lib location and asset name- Parameters:
resourceNode-- Returns:
- clientLibPath
- Throws:
FormsMgrException
-
getThemeRef
public static java.lang.String getThemeRef(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
getCreatorTool
public static java.lang.String getCreatorTool(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
getPropertyAsString
public static java.lang.String getPropertyAsString(javax.jcr.Session session, java.lang.String nodePath, java.lang.String propertyName) throws FormsMgrException- Throws:
FormsMgrException
-
getCategoryNameFromClientLibPath
public 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 '.'- Parameters:
clientLibPath-- Returns:
-
getRenditionNode
public static javax.jcr.Node getRenditionNode(javax.jcr.Node formNode, boolean create) throws FormsMgrException- Throws:
FormsMgrException
-
getResourceTitle
public static java.lang.String getResourceTitle(Resource resource) throws FormsMgrException
- Throws:
FormsMgrException
-
getFormsFoundationAssetType
public static FormsAssetType getFormsFoundationAssetType(FMConstants.CoreAssetType coreAssetType) throws FormsMgrException
This utility is to return Forms Foundation Asset Type deduced from Forms Manager Asset Type.- Parameters:
coreAssetType-- Returns:
- FormsAssetType
- Throws:
FormsMgrException
-
hasMixin
public static boolean hasMixin(javax.jcr.Node node, java.lang.String mixinName) throws javax.jcr.RepositoryExceptionThis utility is to check whether mixinName exists at node or not- Parameters:
node-mixinName-- Returns:
- boolean
- Throws:
javax.jcr.RepositoryException
-
addMixin
public static void addMixin(javax.jcr.Node node, java.lang.String[] mixinNames) throws FormsMgrExceptionThis utility is to add mixinNames at node- Parameters:
node-mixinNames-- Throws:
FormsMgrException
-
cleanUpReplicationInfo
public static void cleanUpReplicationInfo(javax.jcr.Session session, java.lang.String path) throws FormsMgrException- Throws:
FormsMgrException
-
isValidAssetName
public static boolean isValidAssetName(java.lang.String assetName, java.lang.String pattern)
-
isValidFolderName
public static boolean isValidFolderName(java.lang.String folderName)
-
checkForExistingForms
public static boolean checkForExistingForms(java.lang.String assetPath, javax.jcr.Session session, java.lang.String rootPath) throws FormsMgrException, javax.jcr.RepositoryExceptionThis 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.- Parameters:
assetPath-session-rootPath-- Returns:
- boolean
- Throws:
FormsMgrExceptionjavax.jcr.RepositoryException
-
isUserPartOfGroup
public static boolean isUserPartOfGroup(java.security.Principal userPrincipal, UserManager um, java.lang.String groupId) throws javax.jcr.RepositoryExceptionReturns true if given userPrincipal is part of group- Parameters:
userPrincipal-um- reference to UserManager service- Returns:
- boolean
- Throws:
javax.jcr.RepositoryException
-
setLastModifiedTime
public static void setLastModifiedTime(java.lang.String formPath, ResourceResolver resolver)- Parameters:
formPath- dam asset path is expectedresolver- resource resolver
-
notNulOrDefault
public static <T> T notNulOrDefault(T getValue, T defaultValue)
-
setAssetIdentifier
public static void setAssetIdentifier(javax.jcr.Node node, java.lang.String assetType, int validOrdinal) throws FormsMgrExceptionThis API sets the identifier at node.- Parameters:
node- at which identifier is to be setassetType- to be set as an identifier- Throws:
FormsMgrException
-
clientlibExists
public static boolean clientlibExists(java.lang.String clientlibCategoryName, HtmlLibraryManager htmlLibraryManager)API checks whether given client lib category does exist across aem or not- Parameters:
clientlibCategoryName-htmlLibraryManager-- Returns:
-
getRequestParamValue
public static java.lang.String getRequestParamValue(RequestParameterMap paramMap, java.lang.String param)
This function retrieves string value of a request parameter.- Parameters:
paramMap-param-- Returns:
- String value of the req parameter. null is no such param is found.
-
getTitle
public static java.lang.String getTitle(Resource resource)
This API returns title of an asset. If title is empty then it returns name of node.- Parameters:
resource-- Returns:
- String
-
getDisplayType
public static java.lang.String getDisplayType(Resource resource)
This API returns display type of an Asset.- Parameters:
resource-- Returns:
- String
-
getSize
public static long getSize(Resource resource)
This API returns size of Asset. Its applicable for externally authored forms since they have a binary representation.- Parameters:
resource-- Returns:
- long
-
getDescription
public static java.lang.String getDescription(Resource resource)
This API returns description of an Asset.- Parameters:
resource-- Returns:
- String
-
getStatus
public static java.lang.String getStatus(Resource resource)
This API returns current status of an Asset.- Parameters:
resource-- Returns:
- String
-
getLastModified
public static long getLastModified(Resource resource)
This API returns last modified time of an Asset.- Parameters:
resource-- Returns:
- long
-
getPrintChannelResource
public static Resource getPrintChannelResource(Resource resource) throws FormsMgrException
- Parameters:
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 document- Returns:
- Resource representing Print channel of the multichannel document
- Throws:
FormsMgrException- if any exception occurs while trying to load the resource and its hierarchy
-
getFormBytes
public static byte[] getFormBytes(javax.jcr.Session session, java.lang.String formPath) throws FormsMgrExceptionThis API fetches form binaries stored as jcr data at rendition content node- Parameters:
session-formPath-- Returns:
- form binaries
- Throws:
FormsMgrException
-
getOriginalRenditionNode
public static javax.jcr.Node getOriginalRenditionNode(javax.jcr.Node formNode, boolean create) throws java.lang.ExceptionThis API returns original rendition node of given node. If create is true, and original rendition node does not exists, it creates new one.- Parameters:
formNode-create-- Returns:
- original rendition node
- Throws:
java.lang.Exception
-
makeNodeTrusted
public static void makeNodeTrusted(javax.jcr.Node node, boolean isTrusted) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
isDORResolutionRequest
public static boolean isDORResolutionRequest(Resource resource, java.util.Set supportedLocales)
-
isValidXDPResolutionRequest
public static boolean isValidXDPResolutionRequest(Resource resource) throws FormsMgrException
- Throws:
FormsMgrException
-
isValidXFSResolutionRequest
public static boolean isValidXFSResolutionRequest(Resource resource) throws FormsMgrException
- Throws:
FormsMgrException
-
getProbableDamAssetForRendition
public static Resource getProbableDamAssetForRendition(Resource rendition)
climbs back up to the damAsset resource- Parameters:
rendition-- Returns:
-
isVersionMatches
public static boolean isVersionMatches(java.lang.String versionToBeMatched, java.lang.String[] versions)Match a version against a list of versions- Parameters:
versionToBeMatched- - version which needs to be matched against list of versionsversions- - list of versions- Returns:
- boolean
-
isPreAF2
public static boolean isPreAF2(java.lang.String version)
Check if fd:version value belongs to pre AF2 spec versions- Parameters:
version- - version- Returns:
- boolean
-
isAF2
public static boolean isAF2(java.lang.String version)
Check if fd:version value belongs to AF2 spec versions- Parameters:
version- - version- Returns:
- boolean
-
isAF2WithCoreComponent
public static boolean isAF2WithCoreComponent(java.lang.String version)
Check if fd:version value belongs to AF2 Form container core component (v2)- Parameters:
version- - version- Returns:
- boolean
-
isAF2WithHeadlessComponent
public static boolean isAF2WithHeadlessComponent(java.lang.String version)
Check if fd:version value belongs to AF2 Form container headless component (v1)- Parameters:
version- - version- Returns:
- boolean
-
isImmutablePath
public static boolean isImmutablePath(java.lang.String path)
-
getSupportedLanguage
public static java.lang.String getSupportedLanguage(java.util.Locale locale, GuideLocalizationService localizationService)- Parameters:
locale- current localelocalizationService- Guidelocalizationservice instance- Returns:
- current language if locale language is supported, else return en (English)
-
isPropertyProtected
public static boolean isPropertyProtected(javax.jcr.Node node, java.lang.String propertyName) throws javax.jcr.RepositoryExceptionChecks if a property is protected on a given node.- Parameters:
node- the node to check the property onpropertyName- the name of the property to check- Returns:
- true if the property is protected, false otherwise
- Throws:
javax.jcr.RepositoryException- if an error occurs while accessing the repository
-
-