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 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(javax.jcr.Node node, java.lang.String[] mixinNames)
This utility is to add mixinNames at nodestatic ModifiableValueMap
addSignEnabledFlag(JSONObject metadataProperties, ModifiableValueMap mvm)
method to enable sign flag if sign is enabled in templatestatic boolean
canReplicate(java.lang.String path, javax.jcr.Session session)
static boolean
checkForExistingForms(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 void
cleanUpReplicationInfo(javax.jcr.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 notstatic JSONObject
convertSetOfFormInfoToJSONObject(java.util.Set<AssetInfo> formInfoList)
static javax.jcr.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(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 void
deleteTempArchives(javax.jcr.Session session)
Deletes temp archives created in CRX during uploadForm.static javax.jcr.Node
getAnalyticsDataNode(javax.jcr.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 Documentstatic FMConstants.CoreAssetType
getAssetType(javax.jcr.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(javax.jcr.Node resourceNode)
getClientlibPath This API is used to fetch client lib path by appending client lib location and asset namestatic 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 javax.jcr.Node
getContentNode(javax.jcr.Node formNode, boolean create)
static Resource
getContentNode(Resource resource)
static long
getCreated(javax.jcr.Session session, java.lang.String assetPath)
static long
getCreatedPropertyOnNode(javax.jcr.Node node)
static java.lang.String
getCreatorTool(javax.jcr.Session session, java.lang.String path)
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 pathstatic java.lang.String
getDORRefPath(javax.jcr.Session session, java.lang.String guidePath)
static Resource
getFMResourceFromAF(Resource adaptiveForm)
static ResourceResolver
getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory)
This function returns the resource resolver for fd-service system user.static ResourceResolver
getFnDServiceUserResourceResolver(ResourceResolverFactory resourceResolverFactory, java.lang.String subServiceName)
This function returns the resource resolver for user mapped for provided subServiceName.static javax.jcr.Session
getFnDServiceUserSession(SlingRepository repository)
This function returns the session for fd-service system user.static javax.jcr.Node
getFolderNode(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 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(javax.jcr.Session session, java.lang.String assetPath)
static long
getLastUpdatedPropertyOnNode(javax.jcr.Node node)
static javax.jcr.Node
getMetadataNode(javax.jcr.Node formNode, boolean create)
static javax.jcr.Node
getMetadataNode(javax.jcr.Session session, java.lang.String formPath, boolean create)
static java.lang.String
getMetaTemplateRefPath(javax.jcr.Session session, java.lang.String guidePath)
static java.lang.String
getNameFromPath(java.lang.String path)
static javax.jcr.Property
getNodeProperty(java.lang.String propertyName, javax.jcr.Node node)
static javax.jcr.Node
getOriginalRenditionNode(javax.jcr.Node formNode, boolean create)
This API returns original rendition node of given 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 Documentstatic Resource
getPrintChannelResource(Resource resource)
static Resource
getProbableDamAssetForRendition(Resource rendition)
climbs back up to the damAsset resourcestatic java.lang.String
getPropertyAsString(javax.jcr.Session session, java.lang.String nodePath, java.lang.String propertyName)
static javax.jcr.Node
getRenditionNode(javax.jcr.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, javax.jcr.Session session)
static java.lang.String
getResourceTitle(Resource resource)
static java.lang.String
getRootLevelAssetType(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.String
getSchemaRefPath(javax.jcr.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
getSupportedLanguage(java.util.Locale locale, GuideLocalizationService localizationService)
static java.lang.String
getThemeRef(javax.jcr.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(javax.jcr.Session session, java.lang.String guidePath)
static java.lang.String
getXSDRefPath(javax.jcr.Session session, java.lang.String guidePath)
static void
handleViewPrintNodeForDOR(java.lang.String dorType, Resource guideContainerResource)
static boolean
hasDORTemplate(javax.jcr.Session session, java.lang.String path)
static boolean
hasMetaTemplate(javax.jcr.Session session, java.lang.String path)
static boolean
hasMixin(javax.jcr.Node node, java.lang.String mixinName)
This utility is to check whether mixinName exists at node or notstatic boolean
hasProperty(javax.jcr.Session session, java.lang.String path, java.lang.String propertyName)
static boolean
hasSchemaRef(javax.jcr.Session session, java.lang.String path)
static boolean
hasXSDRef(javax.jcr.Session session, java.lang.String path)
static boolean
isAdaptiveDocument(javax.jcr.Session session, java.lang.String path)
static boolean
isAdaptiveForm(Resource resource)
static boolean
isAF2(java.lang.String version)
Check if fd:version value belongs to AF2 spec versionsstatic boolean
isAF2WithCoreComponent(java.lang.String version)
Check if fd:version value belongs to AF2 Form container core component (v2)static boolean
isAF2WithHeadlessComponent(java.lang.String version)
Check if fd:version value belongs to AF2 Form container headless component (v1)static boolean
isAFFragment(javax.jcr.Session session, java.lang.String path)
static boolean
isApplication(javax.jcr.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 notstatic boolean
isDORResolutionRequest(Resource resource, java.util.Set supportedLocales)
static boolean
isFDM(javax.jcr.Session session, java.lang.String path)
static boolean
isFolder(javax.jcr.Session session, java.lang.String path)
static boolean
isForm(FMConstants.CoreAssetType assetType)
static boolean
isFormset(javax.jcr.Session session, java.lang.String path)
static boolean
isGuide(javax.jcr.Session session, java.lang.String path)
static boolean
isImmutablePath(java.lang.String path)
static boolean
isMultichannelDocument(javax.jcr.Session session, java.lang.String path)
static boolean
isPDFForm(javax.jcr.Session session, java.lang.String path)
static boolean
isPreAF2(java.lang.String version)
Check if fd:version value belongs to pre AF2 spec versionsstatic boolean
isPrintForm(javax.jcr.Session session, java.lang.String path)
static boolean
isPropertyProtected(javax.jcr.Node node, java.lang.String propertyName)
Checks if a property is protected on a given node.static boolean
isResource(javax.jcr.Session session, java.lang.String path)
static boolean
isTheme(javax.jcr.Session session, java.lang.String path)
static boolean
isThemeClientLib(javax.jcr.Node assetNode)
static boolean
isUserPartOfGroup(java.security.Principal userPrincipal, UserManager um, java.lang.String groupId)
Returns true if given userPrincipal is part of groupstatic boolean
isValidAssetName(java.lang.String assetName, java.lang.String pattern)
static boolean
isValidFolderName(java.lang.String folderName)
static boolean
isValidXDPResolutionRequest(Resource resource)
static boolean
isValidXFSResolutionRequest(Resource resource)
static boolean
isVersionMatches(java.lang.String versionToBeMatched, java.lang.String[] versions)
Match a version against a list of versionsstatic boolean
isXDPForm(javax.jcr.Session session, java.lang.String path)
static boolean
isXFABasedForm(javax.jcr.Session session, java.lang.String path)
static void
JsonToJcrNode(javax.jcr.Node node, JSONObject jsonObject)
Method to create jcr nodes from json.static void
makeNodeTrusted(javax.jcr.Node node, boolean isTrusted)
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 locationstatic <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
removeAllMixinTypes(javax.jcr.Node node)
static void
setAssetIdentifier(javax.jcr.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)
-
-
-
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 FormsMgrException
Deletes 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.IOException
JSONException
-
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.NullPointerException
javax.jcr.RepositoryException
-
getCreatedPropertyOnNode
public static long getCreatedPropertyOnNode(javax.jcr.Node node) throws java.lang.NullPointerException, javax.jcr.RepositoryException
- Throws:
java.lang.NullPointerException
javax.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.RepositoryException
This 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.RepositoryException
LoginException
-
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:
FormsMgrException
javax.jcr.RepositoryException
PersistenceException
JSONException
-
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.RepositoryException
Method 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:
FormsMgrException
JSONException
javax.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 FormsMgrException
getClientlibPath 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.RepositoryException
This 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 FormsMgrException
This 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.RepositoryException
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.- Parameters:
assetPath
-session
-rootPath
-- Returns:
- boolean
- Throws:
FormsMgrException
javax.jcr.RepositoryException
-
isUserPartOfGroup
public static boolean isUserPartOfGroup(java.security.Principal userPrincipal, UserManager um, java.lang.String groupId) throws javax.jcr.RepositoryException
Returns 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 FormsMgrException
This 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 FormsMgrException
This 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.Exception
This 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.RepositoryException
Checks 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
-
-