org.wso2.carbon.governance.api.util

## Class GovernanceUtils

- java.lang.Object
- - org.wso2.carbon.governance.api.util.GovernanceUtils

-     public class GovernanceUtils
      extends Object

  Utilities used by various Governance API related functionality.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GovernanceUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `associateAspect(String path, String aspect, org.wso2.carbon.registry.core.Registry registry)` Method to associate an aspect with a given resource on the registry.
    `static org.apache.axiom.om.OMElement` | `buildOMElement(byte[] content)` Method to build an AXIOM element from a byte stream.
    `static void` | `CheckMandatoryFields(org.wso2.carbon.registry.core.Registry registry, String elementString, GovernanceArtifact artifact)` Validates a given artifact to ensure all the mandatory fields are filled If a mandatory field is left empty this check method will throw an exception indicating field name to be filled.
    `static String` | `derivePathFromQName(QName qName)` Method to obtain a path from a qualified name.
    `static List<org.apache.axiom.om.OMElement>` | `evaluateXPathToElements(String expression, org.apache.axiom.om.OMElement root)`
    `static GovernanceArtifactConfiguration` | `findGovernanceArtifactConfiguration(String key, org.wso2.carbon.registry.core.Registry registry)` Query to search for a governance artifact configuration.
    `static GovernanceArtifactConfiguration` | `findGovernanceArtifactConfigurationByMediaType(String mediaType, org.wso2.carbon.registry.core.Registry registry)` Query to search for a governance artifact configuration.
    `static List<GovernanceArtifactConfiguration>` | `findGovernanceArtifactConfigurations(org.wso2.carbon.registry.core.Registry registry)` Method to locate Governance Artifact configurations.
    `static List<GovernanceArtifact>` | `findGovernanceArtifacts(Map<String,List<String>> criteria, org.wso2.carbon.registry.core.Registry registry, String mediaType)` Returns a list of governance artifacts found by searching indexes.
    `static String[]` | `findGovernanceArtifacts(String mediaType, org.wso2.carbon.registry.core.Registry registry)` Query to search for governance artifacts.
    `static List<GovernanceArtifact>` | `findGovernanceArtifacts(String criteria, org.wso2.carbon.registry.core.Registry registry, String mediaType)`
    `static List<GovernanceArtifact>` | `findGovernanceArtifacts(String criteria, org.wso2.carbon.registry.core.Registry registry, String mediaType, boolean hasOneProperty)`
    `static ApproveItemBean[]` | `getAllApproveItemBeans(String currentUser, org.wso2.carbon.registry.core.Resource artifactResource, GovernanceArtifact artifact, String artifactLC)` Extracts all ApproveItemBeans from the resource
    `static String[]` | `getAllArtifactIds(org.wso2.carbon.registry.core.Registry registry)` Deprecated. Method to obtain all indexed governance artifact identifiers on the provided registry instance.
    `static String[]` | `getAllArtifactPathsByLifecycle(org.wso2.carbon.registry.core.Registry registry, String lcName, String mediaType)` Retrieve all the governance artifact paths which associated with the given lifecycle
    `static String[]` | `getAllArtifactPathsByLifecycleState(org.wso2.carbon.registry.core.Registry registry, String lcName, String lcState, String mediaType)` Retrieve all the governance artifact paths which associated with the given lifecycle in the given lifecycle state
    `static GovernanceArtifact[]` | `getAllArtifacts(org.wso2.carbon.registry.core.Registry registry)` Deprecated. Method to obtain all indexed governance artifacts on the provided registry instance.
    `static CheckListItemBean[]` | `getAllCheckListItemBeans(org.wso2.carbon.registry.core.Resource artifactResource, GovernanceArtifact artifact, String artifactLC)` Extracts all CheckListItemBeans from the resource and update the lifecycle name and state of the artifact
    `static GovernanceArtifactConfiguration` | `getArtifactConfigurationByMediaType(org.wso2.carbon.registry.core.Registry registry, String mediaType)` Method to return the GovernanceArtifactConfiguration for a given media type
    `static String` | `getArtifactPath(org.wso2.carbon.registry.core.Registry registry, String artifactId)` Method to obtain the artifact path of a governance artifact on the registry.
    `static org.wso2.carbon.registry.common.AttributeSearchService` | `getAttributeSearchService()`
    `static String` | `getAttributeValue(org.apache.axiom.om.OMElement element, String name, String namespace)` Method to obtain the value of a governance attribute.
    `static String[]` | `getAvailableAspects()` Method to obtain all available aspects for the given tenant.
    `static org.wso2.carbon.registry.indexing.service.ContentSearchService` | `getContentSearchService()`
    `static String` | `getDirectArtifactPath(org.wso2.carbon.registry.core.Registry registry, String artifactId)` Method to obtain the artifact path of a governance artifact on the registry.
    `static GovernanceArtifactConfiguration` | `getGovernanceArtifactConfiguration(String elementString)`
    `static org.wso2.carbon.registry.core.Registry` | `getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry)` Returns the system governance registry.
    `static org.wso2.carbon.registry.core.Registry` | `getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry, String username)` Obtains the governance user registry from the given root registry instance.
    `static org.wso2.carbon.registry.core.Registry` | `getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry, String username, int tenantId)` Obtains the governance user registry from the given root registry instance.
    `static String` | `getLifeCycleOfContext(String key, String contextName, org.wso2.carbon.registry.core.Registry registry)`
    `static String` | `getNameFromUrl(String url)` Obtain a name that can represent a URL.
    `static String` | `getPathFromPathExpression(String pathExpression, GovernanceArtifact artifact)` Method to convert the expression specified for storing the path with corresponding values where the artifact is stored.
    `static String` | `getPathFromPathExpression(String pathExpression, GovernanceArtifact artifact, String storagePath)` Method to convert the expression specified for storing the path with corresponding values where the artifact is stored.
    `static String[]` | `getPathsFromPathExpression(String pathExpression, GovernanceArtifact artifact)` Method to convert the expression specified for storing the path with corresponding values where the artifact is stored.
    `static String[]` | `getResultPaths(org.wso2.carbon.registry.core.Registry registry, String mediaType)` Method to obtain a list of paths having resources of the given media type.
    `static javax.cache.Cache<String,Boolean>` | `getRXTConfigCache(String name)` Method used to retrieve cache object for RXT Configs.
    `static List<org.wso2.carbon.registry.common.TermData>` | `getTermDataList(Map<String,List<String>> criteria, String facetField, String mediaType, boolean authRequired)` Find all possible terms and its count for the given facet field and query criteria
    `static List<org.wso2.carbon.registry.common.TermData>` | `getTermDataList(String criteria, String facetField, String mediaType, org.wso2.carbon.registry.core.Registry registry)` Find all possible terms and its count for the given facet field and query criteria
    `static org.wso2.carbon.registry.indexing.service.TermsQuerySearchService` | `getTermsQuerySearchService()`
    `static org.wso2.carbon.registry.indexing.service.TermsSearchService` | `getTermsSearchService()`
    `static List<String>` | `getUniqueAttributesNames(org.wso2.carbon.registry.core.Registry registry, String mediaType)`
    `static boolean` | `hasSamePath(String pathExpression, GovernanceArtifact newArtifact, GovernanceArtifact oldArtifact)` Method to compare the old and new artifact paths
    `static void` | `loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry)` Method to load the Governance Artifacts to be used by the API operations.
    `static void` | `loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry, List<GovernanceArtifactConfiguration> configurations)` Method to load the Governance Artifacts to be used by the API operations.
    `static String` | `parameterizeString(org.wso2.carbon.registry.core.jdbc.handlers.RequestContext requestContext, String parameterString)`
    `static void` | `registerArtifactConfigurationByPath(org.wso2.carbon.registry.core.Registry registry, int tenantId, String path)` This method is used to add artifact configurations into the artifact configuration map given the registry path
    `static void` | `removeArtifact(org.wso2.carbon.registry.core.Registry registry, String artifactId)` Method to remove a governance artifact from the registry.
    `static void` | `removeArtifactFromPath(org.wso2.carbon.registry.core.Registry registry, String path)`
    `static void` | `removeAspect(String path, String aspect, org.wso2.carbon.registry.core.Registry registry)` Method to remove an aspect from a given resource on the registry.
    `static GovernanceArtifact` | `retrieveGovernanceArtifactById(org.wso2.carbon.registry.core.Registry registry, String artifactId)` Method to obtain a governance artifact on the registry.
    `static GovernanceArtifact` | `retrieveGovernanceArtifactByPath(org.wso2.carbon.registry.core.Registry registry, String artifactPath)` Method to obtain a governance artifact on the registry by the artifact path.
    `static String` | `serializeOMElement(org.apache.axiom.om.OMElement element)` Method to serialize an XML element into a string.
    `static void` | `setAttributeSearchService(org.wso2.carbon.registry.common.AttributeSearchService attributeSearchService)`
    `static void` | `setContentSearchService(org.wso2.carbon.registry.indexing.service.ContentSearchService contentSearchService)`
    `static void` | `setDefaultLifeCycle(String path, String aspect, org.wso2.carbon.registry.core.Registry registry)` Method to make an aspect to default.
    `static void` | `setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)` Setting the registry service.
    `static void` | `setTenantGovernanceSystemRegistry(int tenantId)`
    `static void` | `setTermsQuerySearchService(org.wso2.carbon.registry.indexing.service.TermsQuerySearchService termsQuerySearchService)`
    `static void` | `setTermsSearchService(org.wso2.carbon.registry.indexing.service.TermsSearchService termsSearchService)`
    `static void` | `unsetTenantGovernanceSystemRegistry()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GovernanceUtils

          public GovernanceUtils()

  - ### Method Detail

    - #### setRegistryService

          public static void setRegistryService(org.wso2.carbon.registry.core.service.RegistryService registryService)

      Setting the registry service.
      Parameters:
        `registryService` - the registryService.

    - #### registerArtifactConfigurationByPath

          public static void registerArtifactConfigurationByPath(org.wso2.carbon.registry.core.Registry registry,
                                                                 int tenantId,
                                                                 String path)
                                                          throws org.wso2.carbon.registry.core.exceptions.RegistryException

      This method is used to add artifact configurations into the artifact configuration map given the registry path
      Parameters:
        `registry` - registry instance
        `tenantId` - tenant id
        `path` - path of the resource
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### findGovernanceArtifacts

          public static String[] findGovernanceArtifacts(String mediaType,
                                                         org.wso2.carbon.registry.core.Registry registry)
                                                  throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Query to search for governance artifacts.
      Parameters:
        `mediaType` - the media type of the artifacts to be searched for.
        `registry` - the registry instance to run query on.
      Returns:
        the list of artifact paths.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### findGovernanceArtifactConfigurationByMediaType

          public static GovernanceArtifactConfiguration findGovernanceArtifactConfigurationByMediaType(String mediaType,
                                                                                                       org.wso2.carbon.registry.core.Registry registry)
                                                                                                throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Query to search for a governance artifact configuration.
      Parameters:
        `mediaType` - the media type of the artifact configuration.
        `registry` - the registry instance to run query on.
      Returns:
        the artifact configuration.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### findGovernanceArtifactConfiguration

          public static GovernanceArtifactConfiguration findGovernanceArtifactConfiguration(String key,
                                                                                            org.wso2.carbon.registry.core.Registry registry)
                                                                                     throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Query to search for a governance artifact configuration.
      Parameters:
        `key` - the key of the artifact configuration.
        `registry` - the registry instance to run query on.
      Returns:
        the artifact configuration.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### getLifeCycleOfContext

          public static String getLifeCycleOfContext(String key,
                                                     String contextName,
                                                     org.wso2.carbon.registry.core.Registry registry)
                                              throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Parameters:
        `key` - short name of the artifact type.
        `contextName` - context name of which lifecycle is needed
        `registry` - registry instance
      Returns:
        lifecycle of the name associated with the context, null otherwise
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed

    - #### getResultPaths

          public static String[] getResultPaths(org.wso2.carbon.registry.core.Registry registry,
                                                String mediaType)
                                         throws GovernanceException

      Method to obtain a list of paths having resources of the given media type.
      Parameters:
        `registry` - the registry instance to run query on.
        `mediaType` - the media type.
      Returns:
        an array of resource paths.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### loadGovernanceArtifacts

          public static void loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry,
                                                     List<GovernanceArtifactConfiguration> configurations)
                                              throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to load the Governance Artifacts to be used by the API operations.
      Parameters:
        `registry` - the registry instance used to search for artifacts.
        `configurations` - the artifact configurations to load.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### loadGovernanceArtifacts

          public static void loadGovernanceArtifacts(org.wso2.carbon.registry.core.session.UserRegistry registry)
                                              throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to load the Governance Artifacts to be used by the API operations.
      Parameters:
        `registry` - the registry instance used to search for artifacts.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### getGovernanceArtifactConfiguration

          public static GovernanceArtifactConfiguration getGovernanceArtifactConfiguration(String elementString)

    - #### findGovernanceArtifactConfigurations

          public static List<GovernanceArtifactConfiguration> findGovernanceArtifactConfigurations(org.wso2.carbon.registry.core.Registry registry)
                                                                                            throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to locate Governance Artifact configurations.
      Parameters:
        `registry` - the registry instance to run query on.
      Returns:
        an array of resource paths.
      Throws:
        `GovernanceException` - if the operation failed.
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### getArtifactConfigurationByMediaType

          public static GovernanceArtifactConfiguration getArtifactConfigurationByMediaType(org.wso2.carbon.registry.core.Registry registry,
                                                                                            String mediaType)
                                                                                     throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to return the GovernanceArtifactConfiguration for a given media type
      Parameters:
        `registry` - the registry instance to run query on.
        `mediaType` - mediatype of the needed artifact configuration
      Returns:
        GovernanceArtifactConfiguration
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - exception thorown if something goes wrong

    - #### setTenantGovernanceSystemRegistry

          public static void setTenantGovernanceSystemRegistry(int tenantId)
                                                        throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### unsetTenantGovernanceSystemRegistry

          public static void unsetTenantGovernanceSystemRegistry()
                                                          throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### getGovernanceSystemRegistry

          public static org.wso2.carbon.registry.core.Registry getGovernanceSystemRegistry(org.wso2.carbon.registry.core.Registry registry)
                                                                                    throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Returns the system governance registry.
      Parameters:
        `registry` - the user registry.
      Returns:
        the system registry.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - throws if an error occurs

    - #### getGovernanceUserRegistry

          public static org.wso2.carbon.registry.core.Registry getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry,
                                                                                         String username)
                                                                                  throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Obtains the governance user registry from the given root registry instance. This is useful when creating a governance user registry out of a remote client registry instance.
      Parameters:
        `registry` - the remote client registry instance.
        `username` - the name of the user to connect as.
      Returns:
        the system registry.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - throws if an error occurs

    - #### getGovernanceUserRegistry

          public static org.wso2.carbon.registry.core.Registry getGovernanceUserRegistry(org.wso2.carbon.registry.core.Registry registry,
                                                                                         String username,
                                                                                         int tenantId)
                                                                                  throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Obtains the governance user registry from the given root registry instance. This is useful when creating a tenant aware governance user registry out of a remote client registry instance.
      Parameters:
        `registry` - registry the remote client registry instance.
        `username` - username the name of the user to connect as.
        `tenantId` - tenant id
      Returns:
        the system registry
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - throws if an error occurs

    - #### parameterizeString

          public static String parameterizeString(org.wso2.carbon.registry.core.jdbc.handlers.RequestContext requestContext,
                                                  String parameterString)

    - #### removeArtifact

          public static void removeArtifact(org.wso2.carbon.registry.core.Registry registry,
                                            String artifactId)
                                     throws GovernanceException

      Method to remove a governance artifact from the registry.
      Parameters:
        `registry` - the registry instance.
        `artifactId` - the identifier of the artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getArtifactPath

          public static String getArtifactPath(org.wso2.carbon.registry.core.Registry registry,
                                               String artifactId)
                                        throws GovernanceException

      Method to obtain the artifact path of a governance artifact on the registry.
      Parameters:
        `registry` - the registry instance.
        `artifactId` - the identifier of the artifact.
      Returns:
        the artifact path.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getDirectArtifactPath

          public static String getDirectArtifactPath(org.wso2.carbon.registry.core.Registry registry,
                                                     String artifactId)
                                              throws GovernanceException

      Method to obtain the artifact path of a governance artifact on the registry. without going through the UUID cache
      Parameters:
        `registry` - the registry instance.
        `artifactId` - the identifier of the artifact.
      Returns:
        the artifact path.
      Throws:
        `GovernanceException` - if the operation failed. TODO: This method is added since UUID cache cannot be properly implemented without proper TODO: changes in the registry core. getArtifactPath needs to be moved into the registry core TODO: and UUID caching should be handled by the cacheBackedRegistry and cachingHandler

    - #### getAllArtifactPathsByLifecycle

          public static String[] getAllArtifactPathsByLifecycle(org.wso2.carbon.registry.core.Registry registry,
                                                                String lcName,
                                                                String mediaType)
                                                         throws GovernanceException

      Retrieve all the governance artifact paths which associated with the given lifecycle
      Parameters:
        `registry` - registry instance
        `lcName` - lifecycle name
        `mediaType` - mediatype of the artifacts
      Returns:
        String array of all the artifact paths
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllArtifactPathsByLifecycleState

          public static String[] getAllArtifactPathsByLifecycleState(org.wso2.carbon.registry.core.Registry registry,
                                                                     String lcName,
                                                                     String lcState,
                                                                     String mediaType)
                                                              throws GovernanceException

      Retrieve all the governance artifact paths which associated with the given lifecycle in the given lifecycle state
      Parameters:
        `registry` - registry instance
        `lcName` - lifecycle name
        `lcState` - lifecycle state
        `mediaType` - mediatype of the artifacts
      Returns:
        String array of all the artifact paths
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAttributeValue

          public static String getAttributeValue(org.apache.axiom.om.OMElement element,
                                                 String name,
                                                 String namespace)

      Method to obtain the value of a governance attribute.
      Parameters:
        `element` - the payload element.
        `name` - the attribute name.
        `namespace` - the namespace of the payload element.
      Returns:
        the value of the attribute by the given name if it exists or an empty string.

    - #### getAllArtifactIds

          public static String[] getAllArtifactIds(org.wso2.carbon.registry.core.Registry registry)
                                            throws GovernanceException

      Deprecated. Method to obtain all indexed governance artifact identifiers on the provided registry instance.
      Parameters:
        `registry` - the registry instance.
      Returns:
        list of governance artifact identifiers.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllArtifacts

          public static GovernanceArtifact[] getAllArtifacts(org.wso2.carbon.registry.core.Registry registry)
                                                      throws GovernanceException

      Deprecated. Method to obtain all indexed governance artifacts on the provided registry instance.
      Parameters:
        `registry` - the registry instance.
      Returns:
        list of governance artifacts
      Throws:
        `GovernanceException` - if the operation failed.

    - #### retrieveGovernanceArtifactById

          public static GovernanceArtifact retrieveGovernanceArtifactById(org.wso2.carbon.registry.core.Registry registry,
                                                                          String artifactId)
                                                                   throws GovernanceException

      Method to obtain a governance artifact on the registry.
      Parameters:
        `registry` - the registry instance.
        `artifactId` - the identifier of the artifact.
      Returns:
        the artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### retrieveGovernanceArtifactByPath

          public static GovernanceArtifact retrieveGovernanceArtifactByPath(org.wso2.carbon.registry.core.Registry registry,
                                                                            String artifactPath)
                                                                     throws GovernanceException

      Method to obtain a governance artifact on the registry by the artifact path.
      Parameters:
        `registry` - the registry instance.
        `artifactPath` - the path of the artifact.
      Returns:
        the artifact.
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAllCheckListItemBeans

          public static CheckListItemBean[] getAllCheckListItemBeans(org.wso2.carbon.registry.core.Resource artifactResource,
                                                                     GovernanceArtifact artifact,
                                                                     String artifactLC)
                                                              throws GovernanceException

      Extracts all CheckListItemBeans from the resource and update the lifecycle name and state of the artifact
      Parameters:
        `artifactResource` - resource related to the artifact
        `artifact` - artifact which related to the resource
        `artifactLC` - aspect name of which check list item bean is needed
      Returns:
        CheckListItemBean array extracted from the resource
      Throws:
        `GovernanceException` - GovernanceException if the operation failed.

    - #### getAllApproveItemBeans

          public static ApproveItemBean[] getAllApproveItemBeans(String currentUser,
                                                                 org.wso2.carbon.registry.core.Resource artifactResource,
                                                                 GovernanceArtifact artifact,
                                                                 String artifactLC)
                                                          throws GovernanceException

      Extracts all ApproveItemBeans from the resource
      Parameters:
        `currentUser` - current registry user
        `artifactResource` - resource related to the artifact
        `artifact` - artifact related to the resource
      Returns:
        ApproveItemBean array extracted from the resource
      Throws:
        `GovernanceException` - if the operation failed.

    - #### buildOMElement

          public static org.apache.axiom.om.OMElement buildOMElement(byte[] content)
                                                              throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to build an AXIOM element from a byte stream.
      Parameters:
        `content` - the stream of bytes.
      Returns:
        the AXIOM element.
      Throws:
        `GovernanceException` - if the operation failed.
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### serializeOMElement

          public static String serializeOMElement(org.apache.axiom.om.OMElement element)
                                           throws GovernanceException

      Method to serialize an XML element into a string.
      Parameters:
        `element` - the XML element.
      Returns:
        the corresponding String representation
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getPathFromPathExpression

          public static String getPathFromPathExpression(String pathExpression,
                                                         GovernanceArtifact artifact,
                                                         String storagePath)
                                                  throws GovernanceException

      Method to convert the expression specified for storing the path with corresponding values where the artifact is stored.
      Parameters:
        `pathExpression` - the expression specified for storing the path
        `artifact` - the governance artifact
        `storagePath` - the storage path of the artifact
      Returns:
        the path with corresponding values where the artifact is stored
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getPathFromPathExpression

          public static String getPathFromPathExpression(String pathExpression,
                                                         GovernanceArtifact artifact)
                                                  throws GovernanceException

      Method to convert the expression specified for storing the path with corresponding values where the artifact is stored.
      Parameters:
        `pathExpression` - the expression specified for storing the path
        `artifact` - the governance artifact
      Returns:
        the path with corresponding values where the artifact is stored
      Throws:
        `GovernanceException` - if the operation failed.

    - #### hasSamePath

          public static boolean hasSamePath(String pathExpression,
                                            GovernanceArtifact newArtifact,
                                            GovernanceArtifact oldArtifact)
                                     throws GovernanceException

      Method to compare the old and new artifact paths
      Parameters:
        `pathExpression` - the expression specified for storing the path
        `newArtifact` - updated artifact
        `oldArtifact` - existing artifact
      Returns:
        whether the paths are same for old artifact and new artifact
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getPathsFromPathExpression

          public static String[] getPathsFromPathExpression(String pathExpression,
                                                            GovernanceArtifact artifact)
                                                     throws GovernanceException

      Method to convert the expression specified for storing the path with corresponding values where the artifact is stored. This method will return multiple paths.
      Parameters:
        `pathExpression` - the expression specified for storing the path
        `artifact` - the governance artifact
      Returns:
        the paths with corresponding values where the artifact is stored
      Throws:
        `GovernanceException` - if the operation failed.

    - #### getAvailableAspects

          public static String[] getAvailableAspects()
                                              throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to obtain all available aspects for the given tenant.
      Returns:
        list of available aspects.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### derivePathFromQName

          public static String derivePathFromQName(QName qName)

      Method to obtain a path from a qualified name.
      Parameters:
        `qName` - the qualified name.
      Returns:
        the corresponding path.

    - #### getNameFromUrl

          public static String getNameFromUrl(String url)

      Obtain a name that can represent a URL.
      Parameters:
        `url` - the URL.
      Returns:
        the name.

    - #### evaluateXPathToElements

          public static List<org.apache.axiom.om.OMElement> evaluateXPathToElements(String expression,
                                                                                    org.apache.axiom.om.OMElement root)
                                                                             throws org.jaxen.JaxenException

      Throws:
        `org.jaxen.JaxenException`

    - #### associateAspect

          public static void associateAspect(String path,
                                             String aspect,
                                             org.wso2.carbon.registry.core.Registry registry)
                                      throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to associate an aspect with a given resource on the registry.
      Parameters:
        `path` - the path of the resource.
        `aspect` - the aspect to add.
        `registry` - the registry instance on which the resource is available.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### removeAspect

          public static void removeAspect(String path,
                                          String aspect,
                                          org.wso2.carbon.registry.core.Registry registry)
                                   throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to remove an aspect from a given resource on the registry.
      Parameters:
        `path` - the path of the resource.
        `aspect` - the aspect to be removed.
        `registry` - the registry instance on which the resource is available.
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException` - if the operation failed.

    - #### getAttributeSearchService

          public static org.wso2.carbon.registry.common.AttributeSearchService getAttributeSearchService()

    - #### setAttributeSearchService

          public static void setAttributeSearchService(org.wso2.carbon.registry.common.AttributeSearchService attributeSearchService)

    - #### getTermsSearchService

          public static org.wso2.carbon.registry.indexing.service.TermsSearchService getTermsSearchService()

    - #### setTermsSearchService

          public static void setTermsSearchService(org.wso2.carbon.registry.indexing.service.TermsSearchService termsSearchService)

    - #### getContentSearchService

          public static org.wso2.carbon.registry.indexing.service.ContentSearchService getContentSearchService()

    - #### setContentSearchService

          public static void setContentSearchService(org.wso2.carbon.registry.indexing.service.ContentSearchService contentSearchService)

    - #### getTermsQuerySearchService

          public static org.wso2.carbon.registry.indexing.service.TermsQuerySearchService getTermsQuerySearchService()

    - #### setTermsQuerySearchService

          public static void setTermsQuerySearchService(org.wso2.carbon.registry.indexing.service.TermsQuerySearchService termsQuerySearchService)

    - #### setDefaultLifeCycle

          public static void setDefaultLifeCycle(String path,
                                                 String aspect,
                                                 org.wso2.carbon.registry.core.Registry registry)
                                          throws org.wso2.carbon.registry.core.exceptions.RegistryException

      Method to make an aspect to default.
      Parameters:
        `path` - path of the resource
        `aspect` - the aspect to be removed.
        `registry` - registry instance to be used
      Throws:
        `org.wso2.carbon.registry.core.exceptions.RegistryException`

    - #### findGovernanceArtifacts

          public static List<GovernanceArtifact> findGovernanceArtifacts(Map<String,List<String>> criteria,
                                                                         org.wso2.carbon.registry.core.Registry registry,
                                                                         String mediaType)
                                                                  throws GovernanceException

      Returns a list of governance artifacts found by searching indexes. This method requires an instance of an attribute search service.
      Parameters:
        `criteria` - the search criteria
        `registry` - the governance registry instance
      Returns:
        search result
      Throws:
        `GovernanceException` - if the operation failed

    - #### findGovernanceArtifacts

          public static List<GovernanceArtifact> findGovernanceArtifacts(String criteria,
                                                                         org.wso2.carbon.registry.core.Registry registry,
                                                                         String mediaType)
                                                                  throws GovernanceException

      Parameters:
        `criteria` - query string that should be searched for
        `registry` - the governance registry instance
        `mediaType` - media type to be matched for search. Media type can be specified in the query string too
      Returns:
        The list of artifacts. null if the media type and string is empty.
      Throws:
        `GovernanceException` - thrown when an error occurs

    - #### findGovernanceArtifacts

          public static List<GovernanceArtifact> findGovernanceArtifacts(String criteria,
                                                                         org.wso2.carbon.registry.core.Registry registry,
                                                                         String mediaType,
                                                                         boolean hasOneProperty)
                                                                  throws GovernanceException

      Parameters:
        `criteria` - query string that should be searched for
        `registry` - the governance registry instance
        `mediaType` - media type to be matched for search. Media type can be specified in the query string too.
        `hasOneProperty` - To specify whether search criteria contains one property.
      Returns:
        The list of artifacts. null if the media type and string is empty.
      Throws:
        `GovernanceException` - thrown when an error occurs

    - #### getTermDataList

          public static List<org.wso2.carbon.registry.common.TermData> getTermDataList(Map<String,List<String>> criteria,
                                                                                       String facetField,
                                                                                       String mediaType,
                                                                                       boolean authRequired)
                                                                                throws GovernanceException

      Find all possible terms and its count for the given facet field and query criteria
      Parameters:
        `criteria` - the filter criteria to be matched
        `facetField` - field used for faceting : required
        `mediaType` - artifact type need to filter : optional
        `authRequired` - authorization required flag
      Returns:
        term results
      Throws:
        `GovernanceException`

    - #### getTermDataList

          public static List<org.wso2.carbon.registry.common.TermData> getTermDataList(String criteria,
                                                                                       String facetField,
                                                                                       String mediaType,
                                                                                       org.wso2.carbon.registry.core.Registry registry)
                                                                                throws GovernanceException

      Find all possible terms and its count for the given facet field and query criteria
      Parameters:
        `criteria` - the filter criteria to be matched
        `facetField` - field used for faceting : required
        `mediaType` - artifact type need to filter : optional
      Returns:
        term results
      Throws:
        `GovernanceException`

    - #### getRXTConfigCache

          public static javax.cache.Cache<String,Boolean> getRXTConfigCache(String name)

      Method used to retrieve cache object for RXT Configs.
      Parameters:
        `name` - the name of the cache
      Returns:
        the cache object for the given cache manger and cache name

    - #### removeArtifactFromPath

          public static void removeArtifactFromPath(org.wso2.carbon.registry.core.Registry registry,
                                                    String path)
                                             throws GovernanceException

      Throws:
        `GovernanceException`

    - #### getUniqueAttributesNames

          public static List<String> getUniqueAttributesNames(org.wso2.carbon.registry.core.Registry registry,
                                                              String mediaType)
                                                       throws GovernanceException

      Throws:
        `GovernanceException`

    - #### CheckMandatoryFields

          public static void CheckMandatoryFields(org.wso2.carbon.registry.core.Registry registry,
                                                  String elementString,
                                                  GovernanceArtifact artifact)
                                           throws GovernanceException

      Validates a given artifact to ensure all the mandatory fields are filled If a mandatory field is left empty this check method will throw an exception indicating field name to be filled.
      Parameters:
        `registry` - the instance of the registry.
        `elementString` - the short name of the artifact type.
        `artifact` - artifact to be checked for mandatory fields.
      Throws:
        `GovernanceException`

Copyright © 2017 WSO2. All rights reserved.