Class ApiMgtDAO


  • public class ApiMgtDAO
    extends Object
    This class represent the ApiMgtDAO.
    • Method Detail

      • getInstance

        public static ApiMgtDAO getInstance()
        Method to get the instance of the ApiMgtDAO.
        Returns:
        ApiMgtDAO instance
      • createApplicationRegistrationEntry

        public void createApplicationRegistrationEntry​(ApplicationRegistrationWorkflowDTO dto,
                                                       boolean onlyKeyMappingEntry)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Persist the details of the token generation request (allowed domains & validity period) to be used back when approval has been granted.
        Parameters:
        dto - DTO related to Application Registration.
        onlyKeyMappingEntry - When this flag is enabled, only AM_APPLICATION_KEY_MAPPING will get affected.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to create entries in AM_APPLICATION_REGISTRATION and AM_APPLICATION_KEY_MAPPING tables.
      • getSubscribedUsersForAPI

        public APIKeyInfoDTO[] getSubscribedUsersForAPI​(APIInfoDTO apiInfoDTO)
                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API key information for given API
        Parameters:
        apiInfoDTO - API info
        Returns:
        APIKeyInfoDTO[]
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get key info for given API
      • addSubscriber

        public void addSubscriber​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                  String groupingId)
                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriberName

        public String getSubscriberName​(String subscriptionId)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get subscriber name using subscription ID
        Parameters:
        subscriptionId -
        Returns:
        subscriber name
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getMonetizationUsagePublishInfo

        public org.wso2.carbon.apimgt.api.model.MonetizationUsagePublishInfo getMonetizationUsagePublishInfo()
                                                                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Derives info about monetization usage publish job
        Returns:
        ifno about the monetization usage publish job
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addMonetizationUsagePublishInfo

        public void addMonetizationUsagePublishInfo​(org.wso2.carbon.apimgt.api.model.MonetizationUsagePublishInfo monetizationUsagePublishInfo)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Add info about monetization usage publish job
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateUsagePublishInfo

        public void updateUsagePublishInfo​(org.wso2.carbon.apimgt.api.model.MonetizationUsagePublishInfo monetizationUsagePublishInfo)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates info about monetization usage publish job
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateSubscriber

        public void updateSubscriber​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriber

        public org.wso2.carbon.apimgt.api.model.Subscriber getSubscriber​(int subscriberId)
                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addSubscription

        public int addSubscription​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                   org.wso2.carbon.apimgt.api.model.Application application,
                                   String status,
                                   String subscriber)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateSubscription

        public int updateSubscription​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                      String inputSubscriptionUUId,
                                      String status,
                                      String requestedThrottlingTier)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeSubscription

        public void removeSubscription​(org.wso2.carbon.apimgt.api.model.Identifier identifier,
                                       int applicationId)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Removes the subscription entry from AM_SUBSCRIPTIONS for identifier.
        Parameters:
        identifier - Identifier
        applicationId - ID of the application which has the subscription
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeSubscription

        public void removeSubscription​(org.wso2.carbon.apimgt.api.model.SubscribedAPI subscription,
                                       Connection conn)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Removes a subscription specified by SubscribedAPI object
        Parameters:
        subscription - SubscribedAPI object
        conn - database connection object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeSubscriptionById

        public void removeSubscriptionById​(int subscription_id)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Removes a subscription by id by force without considering the subscription blocking state of the user
        Parameters:
        subscription_id - id of subscription
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeAllSubscriptions

        public void removeAllSubscriptions​(String uuid)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionStatusById

        public String getSubscriptionStatusById​(int subscriptionId)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionById

        public org.wso2.carbon.apimgt.api.model.SubscribedAPI getSubscriptionById​(int subscriptionId)
                                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        returns the SubscribedAPI object which is related to the subscriptionId
        Parameters:
        subscriptionId - subscription id
        Returns:
        SubscribedAPI Object which contains the subscribed API information.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionByUUID

        public org.wso2.carbon.apimgt.api.model.SubscribedAPI getSubscriptionByUUID​(String uuid)
                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        returns the SubscribedAPI object which is related to the UUID
        Parameters:
        uuid - UUID of Application
        Returns:
        SubscribedAPI Object which contains the subscribed API information.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriber

        public org.wso2.carbon.apimgt.api.model.Subscriber getSubscriber​(String subscriberName)
                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        This method used tot get Subscriber from subscriberId.
        Parameters:
        subscriberName - id
        Returns:
        Subscriber
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get Subscriber from subscriber id
      • getAPITopics

        public Set<org.wso2.carbon.apimgt.api.model.webhooks.Topic> getAPITopics​(String apiId)
                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the Topic for a specified async API.
        Parameters:
        apiId - API UUID
        Returns:
        Set of Topic objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to retrieve topics of the web hook API
      • getTopicSubscriptions

        public Set<org.wso2.carbon.apimgt.api.model.webhooks.Subscription> getTopicSubscriptions​(String applicationId)
                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves set of web hook topic subscriptions for a application.
        Parameters:
        applicationId - application UUID
        Returns:
        set of web hook subscriptions.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to retrieve web hook topc subscriptions
      • getTopicSubscriptionsByApiUUID

        public Set<org.wso2.carbon.apimgt.api.model.webhooks.Subscription> getTopicSubscriptionsByApiUUID​(String applicationId,
                                                                                                          String apiId)
                                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the web hook topc subscriptions from an application to a given api.
        Parameters:
        applicationId - application uuid
        apiId - api uuid
        Returns:
        set of web hook topic subscriptions
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribedAPIs

        public Set<org.wso2.carbon.apimgt.api.model.SubscribedAPI> getSubscribedAPIs​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                                                                     String applicationName,
                                                                                     String groupingId)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        This method returns the set of APIs for given subscriber, subscribed under the specified application.
        Parameters:
        subscriber - subscriber
        applicationName - Application Name
        Returns:
        Set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get SubscribedAPIs
      • getScopesForApplicationSubscription

        public Set<String> getScopesForApplicationSubscription​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                                               int applicationId)
                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionCount

        public Integer getSubscriptionCount​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                            String applicationName,
                                            String groupingId)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionCountByApplicationId

        public Integer getSubscriptionCountByApplicationId​(org.wso2.carbon.apimgt.api.model.Application application,
                                                           String organization)
                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribedAPIs

        public Set<org.wso2.carbon.apimgt.api.model.SubscribedAPI> getSubscribedAPIs​(String organization,
                                                                                     org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                                                                     String groupingId)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        This method returns the set of APIs for given subscriber
        Parameters:
        organization - identifier of the organization
        subscriber - subscriber
        Returns:
        Set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get SubscribedAPIs
      • getConsumerKeysOfApplication

        public Set<String> getConsumerKeysOfApplication​(int applicationId)
                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Gets ConsumerKeys when given the Application ID.
        Parameters:
        applicationId -
        Returns:
        Set containing ConsumerKeys
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateTierPermissions

        public void updateTierPermissions​(String tierName,
                                          String permissionType,
                                          String roles,
                                          int tenantId)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getTierPermissions

        public Set<TierPermissionDTO> getTierPermissions​(int tenantId)
                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getTierPermission

        public TierPermissionDTO getTierPermission​(String tierName,
                                                   int tenantId)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getThrottleTierPermission

        public TierPermissionDTO getThrottleTierPermission​(String tierName,
                                                           int tenantId)
                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateThrottleTierPermissions

        public void updateThrottleTierPermissions​(String tierName,
                                                  String permissionType,
                                                  String roles,
                                                  int tenantId)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteThrottlingPermissions

        public void deleteThrottlingPermissions​(String tierName,
                                                int tenantId)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getThrottleTierPermissions

        public Set<TierPermissionDTO> getThrottleTierPermissions​(int tenantId)
                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribersOfProvider

        @Deprecated
        public Set<org.wso2.carbon.apimgt.api.model.Subscriber> getSubscribersOfProvider​(String providerName)
                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Deprecated.
        This method returns the set of Subscribers for given provider
        Parameters:
        providerName - name of the provider
        Returns:
        Set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get subscribers for given provider
      • getSubscribersOfAPI

        public Set<org.wso2.carbon.apimgt.api.model.Subscriber> getSubscribersOfAPI​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier)
                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribersOfAPIWithoutDuplicates

        public Set<org.wso2.carbon.apimgt.api.model.Subscriber> getSubscribersOfAPIWithoutDuplicates​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                                                                                                     Map<Integer,​Integer> subscriberMap)
                                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Function returns the set of Subscribers by eliminating replicated subscribers
        Parameters:
        identifier - API Identifier
        subscriberMap - Map of subscriber id and an integer value
        Returns:
        Set of subscribers
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get subscribers for given provider
      • getAPISubscriptionCountByAPI

        public long getAPISubscriptionCountByAPI​(org.wso2.carbon.apimgt.api.model.Identifier identifier)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateSubscription

        public void updateSubscription​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                                       String subStatus,
                                       int applicationId,
                                       String organization)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        This method is used to update the subscription
        Parameters:
        identifier - APIIdentifier
        subStatus - Subscription Status[BLOCKED/UNBLOCKED]
        applicationId - Application id
        organization - Organization
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to update subscriber
      • updateSubscription

        public void updateSubscription​(org.wso2.carbon.apimgt.api.model.SubscribedAPI subscribedAPI)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        This method is used to update the subscription
        Parameters:
        subscribedAPI - subscribedAPI object that represents the new subscription detals
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to update subscription
      • updateSubscriptionStatus

        public void updateSubscriptionStatus​(int subscriptionId,
                                             String status)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateSubscriptionStatusAndTier

        public void updateSubscriptionStatusAndTier​(int subscriptionId,
                                                    String status)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getRegistrationApprovalState

        public Map<String,​String> getRegistrationApprovalState​(int appId,
                                                                     String keyType)
                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateApplicationKeyTypeMapping

        public void updateApplicationKeyTypeMapping​(org.wso2.carbon.apimgt.api.model.Application application,
                                                    String keyType,
                                                    String keyManagerId)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Update the consumer key and application status for the given key type and application.
        Parameters:
        application -
        keyType -
        keyManagerId -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • createApplicationKeyTypeMappingForManualClients

        public void createApplicationKeyTypeMappingForManualClients​(String keyType,
                                                                    int applicationId,
                                                                    String clientId,
                                                                    String keyManagerId,
                                                                    String keyMappingId)
                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        This method will create a new client at key-manager side.further it will add new record to the AM_APPLICATION_KEY_MAPPING table
        Parameters:
        keyType - key type.
        applicationId - apim application id.
        clientId - consumer key.
        keyMappingId - key mapping id.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while creation key mappings.
      • updateApplicationRegistration

        public void updateApplicationRegistration​(String state,
                                                  String keyType,
                                                  int appId,
                                                  String keyManager)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates the state of the Application Registration.
        Parameters:
        state - State of the registration.
        keyType - PRODUCTION | SANDBOX
        appId - ID of the Application.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if updating fails.
      • isSubscribed

        public boolean isSubscribed​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                    String userId)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        apiIdentifier - APIIdentifier
        userId - User Id
        Returns:
        true if user subscribed for given APIIdentifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to check subscribed or not
      • isSubscribedToApp

        public boolean isSubscribedToApp​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                         String userId,
                                         int applicationId)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        apiIdentifier -
        userId -
        applicationId -
        Returns:
        true if user app subscribed for given APIIdentifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to check subscribed or not
      • getAllAPIUsageByProvider

        public org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage[] getAllAPIUsageByProvider​(String providerName)
                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        providerName - Name of the provider
        Returns:
        UserApplicationAPIUsage of given provider
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get UserApplicationAPIUsage for given provider
      • getAllAPIUsageByProviderAndApiId

        public org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage[] getAllAPIUsageByProviderAndApiId​(String uuid,
                                                                                                         String organization)
                                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        uuid - API uuid
        organization - Organization of the API
        Returns:
        UserApplicationAPIUsage of given provider
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get UserApplicationAPIUsage for given provider
      • getAllAPIProductUsageByProvider

        public org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage[] getAllAPIProductUsageByProvider​(String providerName)
                                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        providerName - Name of the provider
        Returns:
        UserApplicationAPIUsage of given provider
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get UserApplicationAPIUsage for given provider
      • getSubscriptionsOfAPI

        public List<org.wso2.carbon.apimgt.api.model.SubscribedAPI> getSubscriptionsOfAPI​(String apiName,
                                                                                          String apiVersion,
                                                                                          String provider)
                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        apiName - Name of the API
        apiVersion - Version of the API
        provider - Name of API creator
        Returns:
        All subscriptions of a given API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addApplication

        public int addApplication​(org.wso2.carbon.apimgt.api.model.Application application,
                                  String userId,
                                  String organization)
                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addRating

        public void addRating​(String id,
                              int rating,
                              String user)
                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addOrUpdateRating

        public void addOrUpdateRating​(String uuid,
                                      int rating,
                                      String userId,
                                      Connection conn)
                               throws org.wso2.carbon.apimgt.api.APIManagementException,
                                      SQLException
        Parameters:
        uuid - API uuid
        rating - Rating
        userId - User Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to add Rating
        SQLException
      • removeAPIRating

        public void removeAPIRating​(String uuid,
                                    String user)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeAPIRating

        public void removeAPIRating​(String uuid,
                                    String userId,
                                    Connection conn)
                             throws org.wso2.carbon.apimgt.api.APIManagementException,
                                    SQLException
        Parameters:
        uuid - API uuid
        userId - User Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to remove API user Rating
        SQLException
      • getUserRating

        public int getUserRating​(String uuid,
                                 String user)
                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getUserRating

        public int getUserRating​(String uuid,
                                 String userId,
                                 Connection conn)
                          throws org.wso2.carbon.apimgt.api.APIManagementException,
                                 SQLException
        Parameters:
        uuid - API uuid
        userId - User Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get User API Rating
        SQLException
      • getUserRatingInfo

        public org.json.simple.JSONObject getUserRatingInfo​(String uuid,
                                                            String user)
                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        uuid - API uuid
        user - User name
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get user API Ratings
      • getAPIRatings

        public org.json.simple.JSONArray getAPIRatings​(String apiId)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        apiId - API uuid
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get API Ratings
      • getAverageRating

        public float getAverageRating​(String apiId)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAverageRating

        public float getAverageRating​(int apiId)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAverageRating

        public float getAverageRating​(String uuid,
                                      Connection conn)
                               throws org.wso2.carbon.apimgt.api.APIManagementException,
                                      SQLException
        Parameters:
        uuid - API uuid
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to add Application
        SQLException
      • getSubscriptionBlockCondition

        public org.wso2.carbon.apimgt.api.model.BlockConditionsDTO getSubscriptionBlockCondition​(String conditionValue,
                                                                                                 String tenantDomain)
                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get details of the subscription block condition by condition value and tenant domain
        Parameters:
        conditionValue - condition value of the block condition
        tenantDomain - tenant domain of the block condition
        Returns:
        Block condition
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addApplication

        public int addApplication​(org.wso2.carbon.apimgt.api.model.Application application,
                                  String userId,
                                  Connection conn,
                                  String organization)
                           throws org.wso2.carbon.apimgt.api.APIManagementException,
                                  SQLException
        Parameters:
        application - Application
        userId - User Id
        organization - Identifier of an organization
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to add Application
        SQLException
      • updateApplication

        public void updateApplication​(org.wso2.carbon.apimgt.api.model.Application application)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateApplicationStatus

        public void updateApplicationStatus​(int applicationId,
                                            String status)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Update the status of the Application creation process
        Parameters:
        applicationId -
        status -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationStatus

        public String getApplicationStatus​(String appName,
                                           String userId)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        get the status of the Application creation process
        Parameters:
        appName -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationStatusById

        public String getApplicationStatusById​(int applicationId)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        get the status of the Application creation process given the application Id
        Parameters:
        applicationId - Id of the Application
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isApplicationExist

        public boolean isApplicationExist​(String appName,
                                          String username,
                                          String groupId,
                                          String organization)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Check whether given application name is available under current subscriber or group
        Parameters:
        appName - application name
        username - subscriber
        groupId - group of the subscriber
        organization - identifier of the organization
        Returns:
        true if application is available for the subscriber
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get applications for given subscriber
      • isApplicationGroupCombinationExists

        public boolean isApplicationGroupCombinationExists​(String applicationName,
                                                           String username,
                                                           String groupId)
                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        applicationName - application name
        username - username
        groupId - group id
        Returns:
        whether a certain application group combination exists or not
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to assess whether a certain application group combination exists or not
      • isApplicationOwnedBySubscriber

        public boolean isApplicationOwnedBySubscriber​(String appName,
                                                      String username,
                                                      String organization)
                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Check whether the new user has an application
        Parameters:
        appName - application name
        username - subscriber
        Returns:
        true if application is available for the subscriber
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get applications for given subscriber
      • getApplicationId

        public int getApplicationId​(String appName,
                                    String username)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        username - Subscriber
        Returns:
        ApplicationId for given appname.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get Applications for given subscriber.
      • getApplicationUUID

        public String getApplicationUUID​(String appName,
                                         String username)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationNameFromId

        public String getApplicationNameFromId​(int applicationId)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Find the name of the application by Id
        Parameters:
        applicationId - - applicatoin id
        Returns:
        - application name
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllApplicationCount

        public int getAllApplicationCount​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                          String groupingId,
                                          String search)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateApplicationOwner

        public boolean updateApplicationOwner​(String userName,
                                              org.wso2.carbon.apimgt.api.model.Application application)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns all applications created by given user Id
        Parameters:
        userName -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationsWithPagination

        public org.wso2.carbon.apimgt.api.model.Application[] getApplicationsWithPagination​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                                                                            String groupingId,
                                                                                            int start,
                                                                                            int offset,
                                                                                            String search,
                                                                                            String sortColumn,
                                                                                            String sortOrder,
                                                                                            String organization)
                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        #TODO later we might need to use only this method.
        Parameters:
        subscriber - The subscriber.
        groupingId - The groupId to which the applications must belong.
        start - The start index.
        offset - The offset.
        search - The search string.
        sortOrder - The sort order.
        sortColumn - The sort column.
        organization - Identifier of an organization
        Returns:
        Application[] The array of applications.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLightWeightApplications

        public org.wso2.carbon.apimgt.api.model.Application[] getLightWeightApplications​(org.wso2.carbon.apimgt.api.model.Subscriber subscriber,
                                                                                         String groupingId)
                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns all the applications associated with given subscriber and group id, without their keys.
        Parameters:
        subscriber - The subscriber.
        groupingId - The groupId to which the applications must belong.
        Returns:
        Application[] Array of applications.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationsWithPagination

        public org.wso2.carbon.apimgt.api.model.Application[] getApplicationsWithPagination​(String user,
                                                                                            String owner,
                                                                                            int tenantId,
                                                                                            int limit,
                                                                                            int offset,
                                                                                            String sortBy,
                                                                                            String sortOrder,
                                                                                            String appName)
                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve the applications by user/application name
        Parameters:
        user -
        owner -
        tenantId -
        limit -
        offset -
        sortBy -
        sortOrder -
        appName -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationsCount

        public int getApplicationsCount​(int tenantId,
                                        String searchOwner,
                                        String searchApplication)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllApplicationsOfTenantForMigration

        public org.wso2.carbon.apimgt.api.model.Application[] getAllApplicationsOfTenantForMigration​(String appTenantDomain)
                                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getConsumerKeys

        public String[] getConsumerKeys​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                                        String organization)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns all the consumerkeys of application which are subscribed for the given api
        Parameters:
        identifier - APIIdentifier
        organization - Organization
        Returns:
        Consumerkeys
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get Applications for given subscriber.
      • deleteApplication

        public void deleteApplication​(org.wso2.carbon.apimgt.api.model.Application application)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Deletes an Application along with subscriptions, keys and registration data
        Parameters:
        application - Application object to be deleted from the database which has the application Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getConsumerKeysForApplication

        public Map<String,​org.apache.commons.lang3.tuple.Pair<String,​String>> getConsumerKeysForApplication​(int appId)
                                                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the consumer keys and keymanager in a given application
        Parameters:
        appId - application id
        Returns:
        Map
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getConsumerKeysWithMode

        public org.wso2.carbon.apimgt.api.model.APIKey[] getConsumerKeysWithMode​(int appId,
                                                                                 String mode)
                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getConsumerKeyByApplicationIdKeyTypeKeyManager

        public String getConsumerKeyByApplicationIdKeyTypeKeyManager​(int applicationId,
                                                                     String keyType,
                                                                     String keyManager)
                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteApplicationKeyMappingByConsumerKey

        public void deleteApplicationKeyMappingByConsumerKey​(String consumerKey)
                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteApplicationKeyMappingByApplicationIdAndType

        public void deleteApplicationKeyMappingByApplicationIdAndType​(int applicationId,
                                                                      String tokenType)
                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        This method will delete a record from AM_APPLICATION_REGISTRATION
        Parameters:
        applicationId -
        tokenType -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteApplicationRegistration

        public void deleteApplicationRegistration​(int applicationId,
                                                  String tokenType,
                                                  String keyManagerName)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete a record from AM_APPLICATION_REGISTRATION table by application ID and token type.
        Parameters:
        applicationId - APIM application ID.
        tokenType - Token type (PRODUCTION || SANDBOX)
        keyManagerName -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to delete the record.
      • recordAPILifeCycleEvent

        public void recordAPILifeCycleEvent​(String uuid,
                                            String oldStatus,
                                            String newStatus,
                                            String userId,
                                            int tenantId)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • recordAPILifeCycleEvent

        public void recordAPILifeCycleEvent​(int apiId,
                                            String oldStatus,
                                            String newStatus,
                                            String userId,
                                            int tenantId)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateDefaultAPIPublishedVersion

        public void updateDefaultAPIPublishedVersion​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLifeCycleEvents

        public List<org.wso2.carbon.apimgt.api.model.LifeCycleEvent> getLifeCycleEvents​(String uuid)
                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • makeKeysForwardCompatible

        public List<org.wso2.carbon.apimgt.api.model.SubscribedAPI> makeKeysForwardCompatible​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                                                                              List<org.wso2.carbon.apimgt.api.model.API> oldAPIVersions)
                                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIVersionsMatchingApiNameAndOrganization

        public List<String> getAPIVersionsMatchingApiNameAndOrganization​(String apiName,
                                                                         String username,
                                                                         String organization)
                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns whether a given API Name already exists
        Parameters:
        apiName - Name of the API
        username - Username
        organization - Identifier of an Organization
        Returns:
        true/false
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get API Names
      • isDuplicateContextTemplateMatchesOrganization

        public boolean isDuplicateContextTemplateMatchesOrganization​(String contextTemplate,
                                                                     String organization)
                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns whether a given API Context already exists
        Parameters:
        contextTemplate - Requested context template
        organization - Identifier of an Organization
        Returns:
        true/false
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get API Contexts
      • addAPI

        public int addAPI​(org.wso2.carbon.apimgt.api.model.API api,
                          int tenantId,
                          String organization)
                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Add API metadata.
        Parameters:
        api - API to add
        tenantId - tenant id
        organization - identifier of the organization
        Returns:
        API Id of the successfully added API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails to add API
      • getDefaultVersion

        public String getDefaultVersion​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiId)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addWorkflowEntry

        public void addWorkflowEntry​(WorkflowDTO workflow)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Persists WorkflowDTO to Database
        Parameters:
        workflow -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateWorkflowStatus

        public void updateWorkflowStatus​(WorkflowDTO workflowDTO)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • retrieveWorkflow

        public WorkflowDTO retrieveWorkflow​(String workflowReference)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns a workflow object for a given external workflow reference.
        Parameters:
        workflowReference -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • retrieveWorkflowFromInternalReference

        public WorkflowDTO retrieveWorkflowFromInternalReference​(String workflowReference,
                                                                 String workflowType)
                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns a workflow object for a given internal workflow reference and the workflow type.
        Parameters:
        workflowReference -
        workflowType -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPublishedDefaultVersion

        public String getPublishedDefaultVersion​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiId)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addUpdateAPIAsDefaultVersion

        public void addUpdateAPIAsDefaultVersion​(org.wso2.carbon.apimgt.api.model.API api,
                                                 Connection connection)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addURITemplates

        public void addURITemplates​(int apiId,
                                    org.wso2.carbon.apimgt.api.model.API api,
                                    int tenantId)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Add URI Templates to database with resource scope mappings.
        Parameters:
        apiId - API Id
        api - API to add URI templates of
        tenantId - Tenant ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If an error occurs while adding URI templates.
      • isAppAllowed

        public boolean isAppAllowed​(int applicationID,
                                    String userId,
                                    String groupId)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Checks whether application is accessible to the specified user
        Parameters:
        applicationID - ID of the Application
        userId - Name of the User.
        groupId - Group IDs
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationByName

        public org.wso2.carbon.apimgt.api.model.Application getApplicationByName​(String applicationName,
                                                                                 String userId,
                                                                                 String groupId)
                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Fetches an Application by name.
        Parameters:
        applicationName - Name of the Application
        userId - Name of the User.
        groupId - Group ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationById

        public org.wso2.carbon.apimgt.api.model.Application getApplicationById​(int applicationId)
                                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationById

        public org.wso2.carbon.apimgt.api.model.Application getApplicationById​(int applicationId,
                                                                               String userId,
                                                                               String groupId)
                                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationByUUID

        public org.wso2.carbon.apimgt.api.model.Application getApplicationByUUID​(String uuid)
                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the Application which is corresponding to the given UUID String
        Parameters:
        uuid - UUID of Application
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateURITemplates

        public void updateURITemplates​(org.wso2.carbon.apimgt.api.model.API api,
                                       int tenantId)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Update URI templates define for an API.
        Parameters:
        api - API to update
        tenantId - tenant Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails to update URI template of the API.
      • getResourceToScopeMapping

        public HashMap<Integer,​Set<String>> getResourceToScopeMapping​(String uuid)
                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get resource (URI Template) to scope mappings of the given API.
        Parameters:
        uuid - API uuid
        Returns:
        Map of URI template ID to Scope Keys
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while getting resource to scope mapping of the API
      • getAllURITemplates

        public ArrayList<org.wso2.carbon.apimgt.api.model.URITemplate> getAllURITemplates​(String apiContext,
                                                                                          String version)
                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        returns all URL templates define for all active(PUBLISHED) APIs.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIProductURITemplates

        public ArrayList<org.wso2.carbon.apimgt.api.model.URITemplate> getAPIProductURITemplates​(String apiContext,
                                                                                                 String version)
                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllURITemplatesOldThrottle

        public ArrayList<org.wso2.carbon.apimgt.api.model.URITemplate> getAllURITemplatesOldThrottle​(String apiContext,
                                                                                                     String version)
                                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllURITemplatesAdvancedThrottle

        public ArrayList<org.wso2.carbon.apimgt.api.model.URITemplate> getAllURITemplatesAdvancedThrottle​(String apiContext,
                                                                                                          String version)
                                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIProductURITemplatesAdvancedThrottle

        public ArrayList<org.wso2.carbon.apimgt.api.model.URITemplate> getAPIProductURITemplatesAdvancedThrottle​(String apiContext,
                                                                                                                 String version)
                                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIProviderByNameAndVersion

        public String getAPIProviderByNameAndVersion​(String apiName,
                                                     String apiVersion,
                                                     String tenant)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        This method is used to get the API provider by giving API name, API version and tenant domain
        Parameters:
        apiName - API name
        apiVersion - API version
        tenant - tenant domain
        Returns:
        API provider
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get the API provider by giving API name, API version, tenant domain
      • createConditionGroupDTO

        public org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO createConditionGroupDTO​(int conditionGroup)
                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Converts an Pipeline object into a ConditionGroupDTO.ConditionGroupDTO class tries to contain the same information held by Pipeline, but in a much lightweight fashion.
        Parameters:
        conditionGroup - Id of the condition group (Pipeline) to be converted
        Returns:
        An object of ConditionGroupDTO type.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateAPI

        public void updateAPI​(org.wso2.carbon.apimgt.api.model.API api)
                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateAPI

        public void updateAPI​(org.wso2.carbon.apimgt.api.model.API api,
                              String username)
                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIID

        public int getAPIID​(String uuid)
                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIID

        public int getAPIID​(String uuid,
                            Connection connection)
                     throws org.wso2.carbon.apimgt.api.APIManagementException,
                            SQLException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
        SQLException
      • setAPIProductFromDB

        public void setAPIProductFromDB​(org.wso2.carbon.apimgt.api.model.APIProduct product)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get product Id from the product name and the provider.
        Parameters:
        product - product identifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - exception
      • deleteApplicationMappingByConsumerKey

        public void deleteApplicationMappingByConsumerKey​(String consumerKey)
                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete a record from AM_APPLICATION_KEY_MAPPING table
        Parameters:
        consumerKey -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteAPI

        public void deleteAPI​(String uuid)
                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationsByTier

        public org.wso2.carbon.apimgt.api.model.Application[] getApplicationsByTier​(String tier)
                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all applications associated with given tier
        Parameters:
        tier - String tier name
        Returns:
        Application object array associated with tier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - on error in getting applications array
      • getURITemplatesPerAPIAsString

        public HashMap<String,​String> getURITemplatesPerAPIAsString​(String uuid)
                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getURITemplatesOfAPI

        public Set<org.wso2.carbon.apimgt.api.model.URITemplate> getURITemplatesOfAPI​(String uuid)
                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getURITemplatesOfAPIWithProductMapping

        public Map<Integer,​org.wso2.carbon.apimgt.api.model.URITemplate> getURITemplatesOfAPIWithProductMapping​(String uuid)
                                                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addComment

        public int addComment​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                              String commentText,
                              String user)
                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Deprecated.
        This method needs to be removed once the Jaggery web apps are removed.
        Adds a comment for an API
        Parameters:
        identifier - API Identifier
        commentText - Commented Text
        user - User who did the comment
        Returns:
        Comment ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addComment

        public String addComment​(String uuid,
                                 org.wso2.carbon.apimgt.api.model.Comment comment,
                                 String user)
                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds a comment for an API
        Parameters:
        uuid - API uuid
        comment - Commented Text
        user - User who did the comment
        Returns:
        Comment ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getComment

        public org.wso2.carbon.apimgt.api.model.Comment getComment​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                                                   String commentId,
                                                                   Integer replyLimit,
                                                                   Integer replyOffset)
                                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns a specific comment of an API
        Parameters:
        commentId - Comment ID
        apiTypeWrapper - Api Type Wrapper
        Returns:
        Comment Array
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getComments

        public org.wso2.carbon.apimgt.api.model.CommentList getComments​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                                                        String parentCommentID,
                                                                        Integer limit,
                                                                        Integer offset)
                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns all the Comments on an API
        Parameters:
        apiTypeWrapper - API type Wrapper
        parentCommentID - Parent Comment ID
        Returns:
        Comment Array
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getComments

        public org.wso2.carbon.apimgt.api.model.Comment[] getComments​(String uuid,
                                                                      String parentCommentID)
                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns all the Comments on an API
        Parameters:
        uuid - API uuid
        parentCommentID - Parent Comment ID
        Returns:
        Comment Array
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • editComment

        public boolean editComment​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                   String commentId,
                                   org.wso2.carbon.apimgt.api.model.Comment comment)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Edit a comment
        Parameters:
        apiTypeWrapper - API Type Wrapper
        commentId - Comment ID
        comment - Comment object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteComment

        public boolean deleteComment​(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper apiTypeWrapper,
                                     String commentId)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete a comment
        Parameters:
        apiTypeWrapper - API Type Wrapper
        commentId - Comment ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteComment

        public void deleteComment​(String uuid,
                                  String commentId)
                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete a comment
        Parameters:
        uuid - API uuid
        commentId - Comment ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isContextExist

        public boolean isContextExist​(String context,
                                      String organization)
      • getAPIContext

        public String getAPIContext​(String uuid)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Context using a new DB connection.
        Parameters:
        uuid - API uuid
        Returns:
        API Context
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getAPIContext

        public String getAPIContext​(String uuid,
                                    Connection connection)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Context by passing an existing DB connection.
        Parameters:
        uuid - API uuid
        connection - DB Connection
        Returns:
        API Context
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getAPIIdentifierFromUUID

        public org.wso2.carbon.apimgt.api.model.APIIdentifier getAPIIdentifierFromUUID​(String uuid)
                                                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Identifier by the the API's UUID.
        Parameters:
        uuid - uuid of the API
        Returns:
        API Identifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getAPIProductIdentifierFromUUID

        public org.wso2.carbon.apimgt.api.model.APIProductIdentifier getAPIProductIdentifierFromUUID​(String uuid)
                                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Product Identifier by the product's UUID.
        Parameters:
        uuid - uuid of the API
        Returns:
        API Identifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getOrganizationByAPIUUID

        public String getOrganizationByAPIUUID​(String apiId)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        apiId - UUID of the API
        Returns:
        organization of the API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getGatewayVendorByAPIUUID

        public String getGatewayVendorByAPIUUID​(String apiId)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve the gateway vendor of an API by providing the UUID
        Parameters:
        apiId - UUID of the API
        Returns:
        gatewayVendor of the API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(org.wso2.carbon.apimgt.api.model.Identifier apiIdentifier,
                                            String organization)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API UUID by the API Identifier.
        Parameters:
        identifier - API Identifier
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(org.wso2.carbon.apimgt.api.model.APIProductIdentifier identifier)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Product UUID by the API Product Identifier.
        Parameters:
        identifier - API Product Identifier
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                                            String organization)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API UUID by the API Identifier.
        Parameters:
        identifier - API Identifier
        organization - identifier of the organization
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(String provider,
                                            String apiName,
                                            String version,
                                            String organization)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API UUID by passed parameters.
        Parameters:
        provider - Provider of the API
        apiName - Name of the API
        version - Version of the API
        organization - identifier of the organization
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(org.wso2.carbon.apimgt.api.model.APIProductIdentifier identifier,
                                            String organization)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API Product UUID by the API Product Identifier and organization.
        Parameters:
        identifier - API Product Identifier
        organization -
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getUUIDFromIdentifier

        public String getUUIDFromIdentifier​(String provider,
                                            String apiName,
                                            String version)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API UUID by passed parameters.
        Parameters:
        provider - Provider of the API
        apiName - Name of the API
        version - Version of the API
        Returns:
        String UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getAPITypeFromUUID

        public String getAPITypeFromUUID​(String uuid)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API TYPE by the uuid.
        Parameters:
        uuid - UUID of API
        Returns:
        String API Type
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • getAllAvailableContexts

        public List<String> getAllAvailableContexts()
      • populateAppRegistrationWorkflowDTO

        public void populateAppRegistrationWorkflowDTO​(ApplicationRegistrationWorkflowDTO workflowDTO)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationIdForAppRegistration

        public int getApplicationIdForAppRegistration​(String workflowReference)
                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getWorkflowReference

        public String getWorkflowReference​(String applicationName,
                                           String userId)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Fetches WorkflowReference when given Application Name and UserId.
        Parameters:
        applicationName -
        userId -
        Returns:
        WorkflowReference
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getWorkflowReferenceByApplicationId

        public String getWorkflowReferenceByApplicationId​(int applicationId,
                                                          String userId)
                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Fetches WorkflowReference when given Application Name and UserId.
        Parameters:
        applicationId -
        userId -
        Returns:
        WorkflowReference
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowReferenceByApplicationID

        public String getExternalWorkflowReferenceByApplicationID​(int appID)
                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Retries the WorkflowExternalReference for a application.
        Parameters:
        appID - ID of the application
        Returns:
        External workflow reference for the application identified
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowRefByInternalRefWorkflowType

        public String getExternalWorkflowRefByInternalRefWorkflowType​(int internalRef,
                                                                      String workflowType)
                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get external workflow reference by internal workflow reference and workflow type
        Parameters:
        internalRef - Internal reference of the workflow
        workflowType - Workflow type of the workflow
        Returns:
        External workflow reference for the given internal reference and workflow type if present. Null otherwise
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If an SQL exception occurs in database interactions
      • removeWorkflowEntry

        public void removeWorkflowEntry​(String workflowReference,
                                        String workflowType)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Remove workflow entry
        Parameters:
        workflowReference -
        workflowType -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowReferenceForSubscription

        public String getExternalWorkflowReferenceForSubscription​(org.wso2.carbon.apimgt.api.model.Identifier identifier,
                                                                  int appID,
                                                                  String organization)
                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Retries the WorkflowExternalReference for a subscription.
        Parameters:
        identifier - Identifier to find the subscribed api
        appID - ID of the application which has the subscription
        organization - organization
        Returns:
        External workflow reference for the subscription identified
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowReferenceForSubscription

        public String getExternalWorkflowReferenceForSubscription​(int subscriptionId)
                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Retries the WorkflowExternalReference for a subscription.
        Parameters:
        subscriptionId - ID of the subscription
        Returns:
        External workflow reference for the subscription subscriptionId
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowReferenceForSubscriptionAndWFType

        public String getExternalWorkflowReferenceForSubscriptionAndWFType​(int subscriptionId,
                                                                           String wfType)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalWorkflowReferenceForUserSignup

        public String getExternalWorkflowReferenceForUserSignup​(String usernameWithDomain)
                                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Retries the WorkflowExternalReference for an user signup by DOMAIN/username.
        Parameters:
        usernameWithDomain - username of the signed up user inthe format of DOMAIN/username
        Returns:
        External workflow reference for the signup workflow entry
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPendingSubscriptionsByApplicationId

        public Set<Integer> getPendingSubscriptionsByApplicationId​(int applicationId)
                                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves IDs of pending subscriptions for a given application
        Parameters:
        applicationId - application id of the application
        Returns:
        Set containing subscription id list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPendingSubscriptionsByAppId

        public Map<String,​Set<Integer>> getPendingSubscriptionsByAppId​(int applicationId)
                                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPendingSubscriptionsByAPIId

        public Set<Integer> getPendingSubscriptionsByAPIId​(String uuid)
                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the IDs of pending subscriptions of a given API
        Parameters:
        uuid - API uuid
        Returns:
        set of subscriptions ids
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getRegistrationWFReference

        public String getRegistrationWFReference​(int applicationId,
                                                 String keyType,
                                                 String keyManagerName)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves registration workflow reference for applicationId and key type
        Parameters:
        applicationId - id of the application with registration
        keyType - key type of the registration
        keyManagerName -
        Returns:
        workflow reference of the registration
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionStatus

        public String getSubscriptionStatus​(String uuid,
                                            int applicationId)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrives subscription status for APIIdentifier and applicationId
        Parameters:
        uuid - API subscribed
        applicationId - application with subscription
        Returns:
        subscription status
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionId

        public String getSubscriptionId​(String uuid,
                                        int applicationId)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves subscription Id for APIIdentifier and applicationId
        Parameters:
        uuid - API subscribed
        applicationId - application with subscription
        Returns:
        subscription id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionCreaeteStatus

        public String getSubscriptionCreaeteStatus​(org.wso2.carbon.apimgt.api.model.APIIdentifier identifier,
                                                   int applicationId,
                                                   String organization,
                                                   Connection connection)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve subscription create state for APIIdentifier and applicationID
        Parameters:
        identifier - - api identifier which is subscribed
        applicationId - - application used to subscribed
        organization - identifier of the organization
        connection -
        Returns:
        subscription create status
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyManagerConfigurationsByOrganization

        public List<org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO> getKeyManagerConfigurationsByOrganization​(String organization)
                                                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyManagerConfigurationByID

        public org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO getKeyManagerConfigurationByID​(String organization,
                                                                                                        String id)
                                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isIDPExistInOrg

        public boolean isIDPExistInOrg​(String organization,
                                       String resourceId)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyManagerConfigurationByName

        public org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO getKeyManagerConfigurationByName​(String organization,
                                                                                                          String name)
                                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyManagerConfigurationByUUID

        public org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO getKeyManagerConfigurationByUUID​(String uuid)
                                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addKeyManagerConfiguration

        public void addKeyManagerConfiguration​(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO keyManagerConfigurationDTO)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isKeyManagerConfigurationExistById

        public boolean isKeyManagerConfigurationExistById​(String organization,
                                                          String id)
                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateKeyManagerConfiguration

        public void updateKeyManagerConfiguration​(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO keyManagerConfigurationDTO)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteKeyManagerConfigurationById

        public void deleteKeyManagerConfigurationById​(String id,
                                                      String organization)
                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyManagerConfigurations

        public List<org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO> getKeyManagerConfigurations()
                                                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isKeyManagerConfigurationExistByName

        public boolean isKeyManagerConfigurationExistByName​(String name,
                                                            String organization)
                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyMappingsFromApplicationId

        public Set<org.wso2.carbon.apimgt.api.model.APIKey> getKeyMappingsFromApplicationId​(int applicationId)
                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyMappingFromApplicationIdAndKeyMappingId

        public org.wso2.carbon.apimgt.api.model.APIKey getKeyMappingFromApplicationIdAndKeyMappingId​(int applicationId,
                                                                                                     String keyMappingId)
                                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteApplicationKeyMappingByMappingId

        public void deleteApplicationKeyMappingByMappingId​(String keyMappingId)
                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getKeyMappingIdFromApplicationIdKeyTypeAndKeyManager

        public String getKeyMappingIdFromApplicationIdKeyTypeAndKeyManager​(int applicationId,
                                                                           String tokenType,
                                                                           String keyManagerName)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateApplicationKeyTypeMetaData

        public void updateApplicationKeyTypeMetaData​(int applicationId,
                                                     String keyType,
                                                     String keyManagerName,
                                                     org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo updatedAppInfo)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        This method used to update Application metadata according to oauth app info
        Parameters:
        applicationId -
        keyType -
        keyManagerName -
        updatedAppInfo -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIInfoByUUID

        public org.wso2.carbon.apimgt.api.model.APIInfo getAPIInfoByUUID​(String apiId)
                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve basic information about the given API by the UUID quering only from AM_API
        Parameters:
        apiId - UUID of the API
        Returns:
        basic information about the API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - error while getting the API information from AM_API
      • getAPIStatusFromAPIUUID

        public String getAPIStatusFromAPIUUID​(String uuid)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • setDefaultVersion

        public void setDefaultVersion​(org.wso2.carbon.apimgt.api.model.API api)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLightWeightAPIInfoByAPIIdentifier

        public org.wso2.carbon.apimgt.api.model.API getLightWeightAPIInfoByAPIIdentifier​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                                                                         String organization)
                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addExternalAPIStoresDetails

        public boolean addExternalAPIStoresDetails​(String uuid,
                                                   Set<org.wso2.carbon.apimgt.api.model.APIStore> apiStoreSet)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Store external APIStore details to which APIs successfully published
        Parameters:
        uuid - API uuid
        apiStoreSet - APIStores set
        Returns:
        added/failed
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteExternalAPIStoresDetails

        public boolean deleteExternalAPIStoresDetails​(String uuid,
                                                      Set<org.wso2.carbon.apimgt.api.model.APIStore> apiStoreSet)
                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete the records of external APIStore details.
        Parameters:
        uuid - API uuid
        apiStoreSet - APIStores set
        Returns:
        added/failed
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateExternalAPIStoresDetails

        public void updateExternalAPIStoresDetails​(String uuid,
                                                   Set<org.wso2.carbon.apimgt.api.model.APIStore> apiStoreSet)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateExternalAPIStoresDetails

        public void updateExternalAPIStoresDetails​(String uuid,
                                                   Set<org.wso2.carbon.apimgt.api.model.APIStore> apiStoreSet,
                                                   Connection conn)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException,
                                                   SQLException
        Updateexternal APIStores details to which APIs published
        Parameters:
        uuid - API uuid
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to add Application
        SQLException
      • getExternalAPIStoresDetails

        public Set<org.wso2.carbon.apimgt.api.model.APIStore> getExternalAPIStoresDetails​(String uuid)
                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Return external APIStore details on successfully APIs published
        Parameters:
        uuid - API uuid
        Returns:
        Set of APIStore
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getExternalAPIStoresDetails

        public Set<org.wso2.carbon.apimgt.api.model.APIStore> getExternalAPIStoresDetails​(String uuid,
                                                                                          Connection conn)
                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException,
                                                                                          SQLException
        Get external APIStores details which are stored in database
        Parameters:
        uuid - API uuid
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get external APIStores
        SQLException
      • getAPIScopeKeys

        public Set<String> getAPIScopeKeys​(String uuid)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Get Scope keys attached to the given API.
        Parameters:
        uuid - API uuid
        Returns:
        set of scope key attached to the API
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails get API scope keys
      • getScopesBySubscribedAPIs

        public Set<String> getScopesBySubscribedAPIs​(List<String> identifiers)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getUnversionedLocalScopeKeysForAPI

        public Set<String> getUnversionedLocalScopeKeysForAPI​(String uuid,
                                                              int tenantId)
                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the unversioned local scope keys set of the API.
        Parameters:
        uuid - API uuid
        tenantId - Tenant Id
        Returns:
        Local Scope keys set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails to get local scope keys for API
      • getVersionedLocalScopeKeysForAPI

        public Set<String> getVersionedLocalScopeKeysForAPI​(String uuid,
                                                            int tenantId)
                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the versioned local scope keys set of the API.
        Parameters:
        uuid - API uuid
        tenantId - Tenant Id
        Returns:
        Local Scope keys set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails to get local scope keys for API
      • getAllLocalScopeKeysForAPI

        public Set<String> getAllLocalScopeKeysForAPI​(String uuid,
                                                      int tenantId)
                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the local scope keys set of the API.
        Parameters:
        uuid - API uuid
        tenantId - Tenant Id
        Returns:
        Local Scope keys set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if fails to get local scope keys for API
      • isApiNameExist

        public boolean isApiNameExist​(String apiName,
                                      String tenantDomain,
                                      String organization)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Check the given api name is already available in the api table under given tenant domain
        Parameters:
        apiName - candidate api name
        tenantDomain - tenant domain name
        Returns:
        true if the name is already available
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isApiNameWithDifferentCaseExist

        public boolean isApiNameWithDifferentCaseExist​(String apiName,
                                                       String tenantDomain,
                                                       String organization)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Check whether another API with a different letter case of the given api name is already available in the api table under the given tenant domain
        Parameters:
        apiName - candidate api name
        tenantDomain - tenant domain name
        Returns:
        true if a different letter case name is already available
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If failed to check different letter case api name availability
      • isScopeKeyAssignedLocally

        public boolean isScopeKeyAssignedLocally​(String apiName,
                                                 String scopeKey,
                                                 int tenantId,
                                                 String organization)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Check whether the given scope key is already assigned locally to another API which are different from the given API or its versioned APIs under given tenant.
        Parameters:
        apiName - API Name
        scopeKey - candidate scope key
        tenantId - tenant id
        organization - identifier of the organization
        Returns:
        true if the scope key is already available
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to check the context availability
      • isScopeKeyAssigned

        public boolean isScopeKeyAssigned​(String scopeKey,
                                          int tenantId)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Check the given scopeKey assigned to any API resource in the given tenant.
        Parameters:
        scopeKey - Scope Key
        tenantId - Tenant Id
        Returns:
        Whether scope assigned or not
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If an error occurs while checking scope assignment
      • getAPINamesMatchingContext

        public List<String> getAPINamesMatchingContext​(String contextTemplate)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        retrieve list of API names which matches given context
        Parameters:
        contextTemplate - context template
        Returns:
        list of API names
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isKeyMappingExistsForApplication

        public boolean isKeyMappingExistsForApplication​(int applicationId,
                                                        String keyManagerName,
                                                        String keyManagerId,
                                                        String keyType)
                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Check if key mappings already exists for app ID, key manager name or ID and key type.
        Parameters:
        applicationId - app ID
        keyManagerName - key manager name
        keyManagerId - key manager ID
        keyType - key type
        Returns:
        true if key mapping exists
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs
      • isKeyMappingExistsForConsumerKeyOrApplication

        public boolean isKeyMappingExistsForConsumerKeyOrApplication​(int applicationId,
                                                                     String keyManagerName,
                                                                     String keyManagerId,
                                                                     String keyType,
                                                                     String consumerKey)
                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Check if key mapping exists for (app ID, key type and key manager) or (consumer key and key manager) values.
        Parameters:
        applicationId - AppID
        keyManagerName - KeyManager Name
        keyManagerId - KeyManager Id
        keyType - KeyType
        consumerKey - Consumer Key
        Returns:
        true if key mapping exists
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs.
      • getConsumerkeyByApplicationIdAndKeyType

        public Map<String,​String> getConsumerkeyByApplicationIdAndKeyType​(int applicationId,
                                                                                String keyType)
                                                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        applicationId -
        keyType -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLastPublishedAPIVersionFromAPIStore

        public String getLastPublishedAPIVersionFromAPIStore​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                                             String storeName)
                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Get external APIStores details which are stored in database
        Parameters:
        apiIdentifier - API Identifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get external APIStores
      • getAllAlertTypesByStakeHolder

        public HashMap<Integer,​String> getAllAlertTypesByStakeHolder​(String stakeHolder)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        This method will fetch all alerts type that is available in AM_ALERT_TYPES.
        Parameters:
        stakeHolder - the name of the stakeholder. whether its "subscriber", "publisher" or "admin-dashboard"
        Returns:
        List of alert types
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSavedAlertTypesIdsByUserNameAndStakeHolder

        public List<Integer> getSavedAlertTypesIdsByUserNameAndStakeHolder​(String userName,
                                                                           String stakeHolder)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        userName - user name with tenant domain ex: [email protected]
        stakeHolder - value "p" for publisher value "s" for subscriber value "a" for admin
        Returns:
        map of saved values of alert types.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • retrieveSavedEmailList

        public List<String> retrieveSavedEmailList​(String userName,
                                                   String stakeHolder)
                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        This method will retrieve saved emails list by user name and stakeholder.
        Parameters:
        userName - user name.
        stakeHolder - "publisher" , "subscriber" or "admin-dashboard"
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • unSubscribeAlerts

        public void unSubscribeAlerts​(String userName,
                                      String agent)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        This method will delete all email alert subscriptions details from tables
        Parameters:
        userName -
        agent - whether its publisher or store or admin dash board.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAlertTypesConfigInfo

        public void addAlertTypesConfigInfo​(String userName,
                                            String emailList,
                                            String alertTypesIDList,
                                            String stakeHolder)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Parameters:
        userName - User name.
        emailList - Comma separated email list.
        alertTypesIDList - Comma separated alert types list.
        stakeHolder - if pram value = p we assume those changes from publisher if param value = s those data belongs to subscriber.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
        SQLException
      • addApplicationPolicy

        public void addApplicationPolicy​(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy policy)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a Application level throttling policy to database
        Parameters:
        policy - policy object defining the throttle policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addSubscriptionPolicy

        public void addSubscriptionPolicy​(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy policy)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a Subscription level throttling policy to database
        Parameters:
        policy - policy object defining the throttle policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAPIPolicy

        public org.wso2.carbon.apimgt.api.model.policy.APIPolicy addAPIPolicy​(org.wso2.carbon.apimgt.api.model.policy.APIPolicy policy)
                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Wrapper method for addAPIPolicy(APIPolicy, Connection) to add API Policy without managing the database connection manually.
        Parameters:
        policy - policy object to add
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateAPIPolicy

        public org.wso2.carbon.apimgt.api.model.policy.APIPolicy updateAPIPolicy​(org.wso2.carbon.apimgt.api.model.policy.APIPolicy policy)
                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Update a API level throttling policy to database.

        If condition group already exists for the policy, that condition Group will be deleted and condition Group will be inserted to the database with old POLICY_ID.

        Parameters:
        policy - policy object defining the throttle policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addGlobalPolicy

        public void addGlobalPolicy​(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy policy)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a Global level throttling policy to database
        Parameters:
        policy - Global Policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getGlobalPolicyKeyTemplates

        public List<String> getGlobalPolicyKeyTemplates​(int tenantID)
                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves global policy key templates for the given tenantID
        Parameters:
        tenantID - tenant id
        Returns:
        list of KeyTemplates
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isKeyTemplatesExist

        public boolean isKeyTemplatesExist​(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy policy)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns true if the key template exist in DB
        Parameters:
        policy - Global Policy
        Returns:
        true if key template already exists
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeThrottlePolicy

        public void removeThrottlePolicy​(String policyLevel,
                                         String policyName,
                                         int tenantId)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Removes a throttling policy from the database
        Parameters:
        policyLevel - level of the policy to be deleted
        policyName - name of the policy
        tenantId - used to get the tenant id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIPolicies

        public org.wso2.carbon.apimgt.api.model.policy.APIPolicy[] getAPIPolicies​(int tenantID)
                                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Get API level policies. Result only contains basic details of the policy, it doesn't contain pipeline information.
        Parameters:
        tenantID - policies are selected using tenantID
        Returns:
        APIPolicy ArrayList
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationPolicies

        public org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy[] getApplicationPolicies​(int tenantID)
                                                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Get application level polices
        Parameters:
        tenantID - polices are selected only belong to specific tenantID
        Returns:
        AppilicationPolicy array list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionPolicies

        public org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy[] getSubscriptionPolicies​(int tenantID)
                                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all subscription level policeis belongs to specific tenant
        Parameters:
        tenantID - tenantID filters the polices belongs to specific tenant
        Returns:
        subscriptionPolicy array list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionPolicies

        public org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy[] getSubscriptionPolicies​(String[] subscriptionTiers,
                                                                                                    int tenantID)
                                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get subscription level policies specified by tier names belonging to a specific tenant
        Parameters:
        subscriptionTiers - subscription tiers
        tenantID - tenantID filters the polices belongs to specific tenant
        Returns:
        subscriptionPolicy array list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getGlobalPolicies

        public org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy[] getGlobalPolicies​(int tenantID)
                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all Global level policeis belongs to specific tenant
        Parameters:
        tenantID -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getGlobalPolicy

        public org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy getGlobalPolicy​(String policyName)
                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get a particular Global level policy.
        Parameters:
        policyName - name of the global polixy
        Returns:
        GlobalPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getGlobalPolicyByUUID

        public org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy getGlobalPolicyByUUID​(String uuid)
                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Get a particular Global level policy given UUID.
        Parameters:
        uuid - name of the global polixy
        Returns:
        GlobalPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIPolicy

        public org.wso2.carbon.apimgt.api.model.policy.APIPolicy getAPIPolicy​(String policyName,
                                                                              int tenantId)
                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves APIPolicy with name policyName and tenant Id tenantNId

        This will retrieve complete details about the APIPolicy with all pipelins and conditions.

        Parameters:
        policyName - name of the policy to retrieve from the database
        tenantId - tenantId of the policy
        Returns:
        APIPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIPolicyByUUID

        public org.wso2.carbon.apimgt.api.model.policy.APIPolicy getAPIPolicyByUUID​(String uuid)
                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves APIPolicy with name uuid

        This will retrieve complete details about the APIPolicy with all pipelines and conditions.

        Parameters:
        uuid - uuid of the policy to retrieve from the database
        Returns:
        APIPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationPolicy

        public org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy getApplicationPolicy​(String policyName,
                                                                                              int tenantId)
                                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves ApplicationPolicy with name policyName and tenant Id tenantNId
        Parameters:
        policyName - name of the policy to retrieve from the database
        tenantId - tenantId of the policy
        Returns:
        ApplicationPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationPolicyByUUID

        public org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy getApplicationPolicyByUUID​(String uuid)
                                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves ApplicationPolicy with name uuid
        Parameters:
        uuid - uuid of the policy to retrieve from the database
        Returns:
        ApplicationPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionPolicy

        public org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy getSubscriptionPolicy​(String policyName,
                                                                                                int tenantId)
                                                                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves SubscriptionPolicy with name policyName and tenant Id tenantNId
        Parameters:
        policyName - name of the policy to retrieve from the database
        tenantId - tenantId of the policy
        Returns:
        SubscriptionPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscriptionPolicyByUUID

        public org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy getSubscriptionPolicyByUUID​(String uuid)
                                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves SubscriptionPolicy with name uuid
        Parameters:
        uuid - name of the policy to retrieve from the database
        Returns:
        SubscriptionPolicy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateApplicationPolicy

        public void updateApplicationPolicy​(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy policy)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates Application level policy.

        policy name and tenant id should be specified in policy

        Parameters:
        policy - updated policy object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateSubscriptionPolicy

        public void updateSubscriptionPolicy​(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy policy)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates Subscription level policy.

        policy name and tenant id should be specified in policy

        Parameters:
        policy - updated policy object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateGlobalPolicy

        public void updateGlobalPolicy​(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy policy)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates global throttle policy in database
        Parameters:
        policy - updated policy obejct
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPolicyNames

        public String[] getPolicyNames​(String policyLevel,
                                       String username)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves list of available policy names under policyLevel and user username's tenant
        Parameters:
        policyLevel - policY level to filter policies
        username - username will be used to get the tenant
        Returns:
        array of policy names
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • setPolicyDeploymentStatus

        public void setPolicyDeploymentStatus​(String policyLevel,
                                              String policyName,
                                              int tenantId,
                                              boolean isDeployed)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Sets deployment status vaule of a policy in database.
        Parameters:
        policyLevel - policy level
        policyName - name of the policy
        tenantId - tenant id of the policy
        isDeployed - deployment status. true if deployment successful, false if not
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isPolicyExist

        public boolean isPolicyExist​(String policyType,
                                     int tenantId,
                                     String policyName)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isPolicyExist

        public boolean isPolicyExist​(Connection connection,
                                     String policyType,
                                     int tenantId,
                                     String policyName)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isPolicyDeployed

        public boolean isPolicyDeployed​(String policyType,
                                        int tenantId,
                                        String policyName)
                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addBlockConditions

        public org.wso2.carbon.apimgt.api.model.BlockConditionsDTO addBlockConditions​(org.wso2.carbon.apimgt.api.model.BlockConditionsDTO blockConditionsDTO)
                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a block condition
        Returns:
        uuid of the block condition if successfully added
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getBlockCondition

        public org.wso2.carbon.apimgt.api.model.BlockConditionsDTO getBlockCondition​(int conditionId)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Get details of a block condition by Id
        Parameters:
        conditionId - id of the condition
        Returns:
        Block conditoin represented by the UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getBlockConditionByUUID

        public org.wso2.carbon.apimgt.api.model.BlockConditionsDTO getBlockConditionByUUID​(String uuid)
                                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Get details of a block condition by UUID
        Parameters:
        uuid - uuid of the block condition
        Returns:
        Block condition represented by the UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getBlockConditions

        public List<org.wso2.carbon.apimgt.api.model.BlockConditionsDTO> getBlockConditions​(String tenantDomain)
                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateBlockConditionState

        public boolean updateBlockConditionState​(int conditionId,
                                                 String state)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Update the block condition state true (Enabled) /false (Disabled) given the UUID
        Parameters:
        conditionId - id of the block condition
        state - blocking state
        Returns:
        true if the operation was success
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateBlockConditionStateByUUID

        public boolean updateBlockConditionStateByUUID​(String uuid,
                                                       String state)
                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Update the block condition state true (Enabled) /false (Disabled) given the UUID
        Parameters:
        uuid - UUID of the block condition
        state - blocking state
        Returns:
        true if the operation was success
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteBlockCondition

        public boolean deleteBlockCondition​(int conditionId)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete the block condition given the id
        Parameters:
        conditionId - id of the condition
        Returns:
        true if successfully deleted
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteBlockConditionByUUID

        public boolean deleteBlockConditionByUUID​(String uuid)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete the block condition given the id
        Parameters:
        uuid - UUID of the block condition
        Returns:
        true if successfully deleted
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPILevelTier

        public String getAPILevelTier​(int id)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPILevelTier

        public String getAPILevelTier​(String apiUUID,
                                      String revisionUUID)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • fillQueryParams

        public PreparedStatement fillQueryParams​(Connection conn,
                                                 String query,
                                                 String[] params,
                                                 int startingParamIndex)
                                          throws SQLException
        Returns a Prepared statement after setting all the dynamic parameters. Dynamic parameters will be added in the place of $params in query string
        Parameters:
        conn - connection which will be used to create a prepared statement
        query - dynamic query string which will be modified.
        params - list of parameters
        startingParamIndex - index from which the parameter numbering will start.
        Returns:
        Throws:
        SQLException
      • isGrpIdMappingTableExist

        public boolean isGrpIdMappingTableExist()
        Returns True if AM_APPLICATION_GROUP_MAPPING table exist in AM DB
        Returns:
      • getGroupId

        public String getGroupId​(int applicationId)
                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribedAPIsForAnApp

        public APISubscriptionInfoDTO[] getSubscribedAPIsForAnApp​(String userId,
                                                                  int applicationID)
                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Get Subscribed APIs for an App.
        Parameters:
        applicationID - id of the application name
        Returns:
        APISubscriptionInfoDTO[]
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to get Subscribed APIs
      • getApplicationByClientId

        public org.wso2.carbon.apimgt.api.model.Application getApplicationByClientId​(String clientId)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllEnvironments

        public List<org.wso2.carbon.apimgt.api.model.Environment> getAllEnvironments​(String tenantDomain)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns the Environments List for the TenantId.
        Parameters:
        tenantDomain - The tenant domain.
        Returns:
        List of Environments.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getEnvironment

        public org.wso2.carbon.apimgt.api.model.Environment getEnvironment​(String tenantDomain,
                                                                           String uuid)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Returns the Environment for the uuid in the tenant domain.
        Parameters:
        tenantDomain - the tenant domain to look environment
        uuid - UUID of the environment
        Returns:
        Gateway environment with given UUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addEnvironment

        public org.wso2.carbon.apimgt.api.model.Environment addEnvironment​(String tenantDomain,
                                                                           org.wso2.carbon.apimgt.api.model.Environment environment)
                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Add an Environment
        Parameters:
        tenantDomain - tenant domain
        environment - Environment
        Returns:
        added Environment
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to add environment
      • deleteEnvironment

        public void deleteEnvironment​(String uuid)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete an Environment
        Parameters:
        uuid - UUID of the environment
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to delete environment
      • updateEnvironment

        public org.wso2.carbon.apimgt.api.model.Environment updateEnvironment​(org.wso2.carbon.apimgt.api.model.Environment environment)
                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Update Gateway Environment
        Parameters:
        environment - Environment to be updated
        Returns:
        Updated Environment
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if failed to updated Environment
      • getApplicationAttributes

        public Map<String,​String> getApplicationAttributes​(Connection conn,
                                                                 int applicationId)
                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all attributes stored against an Application
        Parameters:
        conn - Database connection
        applicationId -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteApplicationAttributes

        public void deleteApplicationAttributes​(String attributeKey,
                                                int applicationId)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete certain attribute stored against an Application
        Parameters:
        attributeKey - User defined key of attribute
        applicationId -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addApplicationAttributes

        public void addApplicationAttributes​(Map<String,​String> applicationAttributes,
                                             int applicationId,
                                             int tenantId)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Add new attributes against an Application in API Store
        Parameters:
        applicationAttributes - Map of key, value pair of attributes
        applicationId - Id of Application against which attributes are getting stored
        tenantId - Id of tenant
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • convertNullThrottlingTiers

        public void convertNullThrottlingTiers()
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Converts all null values for THROTTLING_TIER in AM_API_URL_MAPPING table, to Unlimited. This will be executed only during startup of the server.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getApplicationBySubscriberIdAndName

        public org.wso2.carbon.apimgt.api.model.Application getApplicationBySubscriberIdAndName​(int subscriberId,
                                                                                                String applicationName)
                                                                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves the Application which is corresponding to the given UUID String
        Parameters:
        subscriberId - subscriberId of the Application
        applicationName - name of the Application
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getURITemplatesForAPI

        public Map<String,​org.wso2.carbon.apimgt.api.model.URITemplate> getURITemplatesForAPI​(org.wso2.carbon.apimgt.api.model.API api)
                                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve URI Templates for the given API
        Parameters:
        api - API
        Returns:
        Map of URITemplate with key as Method:resourcepath
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - exception
      • getResourcePathsOfAPI

        public List<org.wso2.carbon.apimgt.api.model.ResourcePath> getResourcePathsOfAPI​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiId)
                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAPIProduct

        public void addAPIProduct​(org.wso2.carbon.apimgt.api.model.APIProduct apiProduct,
                                  String organization)
                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAPIProductResourceMappings

        public void addAPIProductResourceMappings​(List<org.wso2.carbon.apimgt.api.model.APIProductResource> productResources,
                                                  String organization,
                                                  Connection connection)
                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Add api product url mappings to DB - url templeates to product mappings (resource bundling) - AM_API_PRODUCT_MAPPING
        Parameters:
        productResources -
        organization -
        connection -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateAPIProductResourceMappings

        public void updateAPIProductResourceMappings​(org.wso2.carbon.apimgt.api.model.APIProduct apiProduct,
                                                     int productId,
                                                     Connection connection)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Update Product scope and resource mappings
        Parameters:
        apiProduct -
        productId -
        connection -
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteAPIProduct

        public void deleteAPIProduct​(org.wso2.carbon.apimgt.api.model.APIProductIdentifier productIdentifier)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete API product and its related scopes
        Parameters:
        productIdentifier - product ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getProductMappingsForAPI

        public List<org.wso2.carbon.apimgt.api.model.APIProductResource> getProductMappingsForAPI​(org.wso2.carbon.apimgt.api.model.API api)
                                                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIProductId

        public int getAPIProductId​(org.wso2.carbon.apimgt.api.model.APIProductIdentifier identifier)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateAPIProduct

        public void updateAPIProduct​(org.wso2.carbon.apimgt.api.model.APIProduct product,
                                     String username)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPIProductResourceMappings

        public List<org.wso2.carbon.apimgt.api.model.APIProductResource> getAPIProductResourceMappings​(org.wso2.carbon.apimgt.api.model.APIProductIdentifier productIdentifier)
                                                                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        get resource mapping of the api product TODO://Get resource scopes from AM_API_RESOURCE_SCOPE table and retrieve scope meta data and bindings from KM.
        Parameters:
        productIdentifier - api product identifier
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAuditApiMapping

        public void addAuditApiMapping​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                       String uuid,
                                       String organization)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Add new Audit API ID
        Parameters:
        apiIdentifier - APIIdentifier object to retrieve API ID
        uuid - Audit API ID
        organization - Organization
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAuditApiId

        public String getAuditApiId​(String uuid)
                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get Audit API ID
        Parameters:
        uuid - API uuid to retrieve API ID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addComplexityDetails

        public void addComplexityDetails​(String apiUuid,
                                         org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlComplexityInfo graphqlComplexityInfo)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Add custom complexity details for a particular API
        Parameters:
        apiUuid - API uuid to retrieve API ID
        graphqlComplexityInfo - GraphqlComplexityInfo object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateComplexityDetails

        public void updateComplexityDetails​(String uuid,
                                            org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlComplexityInfo graphqlComplexityInfo)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Update custom complexity details for a particular API
        Parameters:
        uuid - API uuid object to retrieve API ID
        graphqlComplexityInfo - GraphqlComplexityInfo object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addOrUpdateComplexityDetails

        public void addOrUpdateComplexityDetails​(String uuid,
                                                 org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlComplexityInfo graphqlComplexityInfo)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Add or Update complexity details
        Parameters:
        uuid - API uuid to retrieve API ID
        graphqlComplexityInfo - GraphqlComplexityDetails object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getComplexityDetails

        public org.wso2.carbon.apimgt.api.model.graphql.queryanalysis.GraphqlComplexityInfo getComplexityDetails​(String uuid)
                                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get custom complexity details for a particular API
        Parameters:
        uuid - API UUID to retrieve API ID
        Returns:
        info about the complexity details
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addBotDetectionAlertSubscription

        public void addBotDetectionAlertSubscription​(String email)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a bot detection alert subscription
        Parameters:
        email - email to be registered for the subscription
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a bot detection alert subscription
      • getBotDetectionAlertSubscriptions

        public List<org.wso2.carbon.apimgt.api.model.botDataAPI.BotDetectionData> getBotDetectionAlertSubscriptions()
                                                                                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve all bot detection alert subscriptions
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when retrieving bot detection alert subscriptions
      • deleteBotDetectionAlertSubscription

        public void deleteBotDetectionAlertSubscription​(String uuid)
                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete a bot detection alert subscription
        Parameters:
        uuid - uuid of the subscription
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when deleting a bot detection alert subscription
      • getBotDetectionAlertSubscription

        public org.wso2.carbon.apimgt.api.model.botDataAPI.BotDetectionData getBotDetectionAlertSubscription​(String field,
                                                                                                             String value)
                                                                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve a bot detection alert subscription by querying a particular field (uuid or email)
        Parameters:
        field - field to be queried to obtain the bot detection alert subscription. Can be uuid or email
        value - value corresponding to the field (uuid or email value)
        Returns:
        if subscription exist, returns the bot detection alert subscription, else returns a null object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when retrieving a bot detection alert subscription
      • addRevokedJWTSignature

        public void addRevokedJWTSignature​(String eventId,
                                           String jwtSignature,
                                           String type,
                                           Long expiryTime,
                                           int tenantId)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Persist revoked jwt signatures to database.
        Parameters:
        eventId -
        jwtSignature - signature of jwt token.
        expiryTime - expiry time of the token.
        tenantId - tenant id of the jwt subject.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • removeExpiredJWTs

        public void removeExpiredJWTs()
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Removes expired JWTs from revoke table.
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addCategory

        public org.wso2.carbon.apimgt.api.model.APICategory addCategory​(org.wso2.carbon.apimgt.api.model.APICategory category,
                                                                        String organization)
                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds an API category
        Parameters:
        category - Category
        organization - Organization
        Returns:
        Category
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateCategory

        public void updateCategory​(org.wso2.carbon.apimgt.api.model.APICategory apiCategory)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Update API Category
        Parameters:
        apiCategory - API category object with updated details
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllCategories

        public List<org.wso2.carbon.apimgt.api.model.APICategory> getAllCategories​(String organization)
                                                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all available API categories of the organization
        Parameters:
        organization -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • isAPICategoryNameExists

        public boolean isAPICategoryNameExists​(String categoryName,
                                               String uuid,
                                               String organization)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Checks whether the given category name is already available under given tenant domain with any UUID other than the given UUID
        Parameters:
        categoryName -
        uuid -
        organization -
        Returns:
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPICategoryByID

        public org.wso2.carbon.apimgt.api.model.APICategory getAPICategoryByID​(String apiCategoryID)
                                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteCategory

        public void deleteCategory​(String categoryID)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addUserID

        public String addUserID​(String userID,
                                String userName)
                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getUserID

        public String getUserID​(String userName)
                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getNamesOfTierWithBandwidthQuotaType

        public List<String> getNamesOfTierWithBandwidthQuotaType​(int tenantId)
                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get names of the tiers which has bandwidth as the quota type
        Parameters:
        tenantId - id of the tenant
        Returns:
        list of names
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteWorkflowRequest

        public void deleteWorkflowRequest​(String workflowExtRef)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Remove the Pending workflow Requests using ExternalWorkflowReference
        Parameters:
        workflowExtRef - External Workflow Reference of Workflow Pending Request
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getworkflowReferenceByExternalWorkflowReference

        public org.wso2.carbon.apimgt.api.model.Workflow getworkflowReferenceByExternalWorkflowReference​(String externalWorkflowRef)
                                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the Pending workflow Request using ExternalWorkflowReference
        Parameters:
        externalWorkflowRef -
        Returns:
        workflow pending request
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getworkflows

        public org.wso2.carbon.apimgt.api.model.Workflow[] getworkflows​(String workflowType,
                                                                        String status,
                                                                        String tenantDomain)
                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the Pending workflow Requests using WorkflowType for a particular tenant
        Parameters:
        workflowType - Type of the workflow pending request
        status - workflow status of workflow pending request
        tenantDomain - tenantDomain of the user
        Returns:
        List of workflow pending request
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getworkflowReferenceByExternalWorkflowReferenceID

        public org.wso2.carbon.apimgt.api.model.Workflow getworkflowReferenceByExternalWorkflowReferenceID​(String externelWorkflowRef,
                                                                                                           String status,
                                                                                                           String tenantDomain)
                                                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the Pending workflow Request using ExternalWorkflowReference for a particular tenant
        Parameters:
        externelWorkflowRef - of pending workflow request
        status - workflow status of workflow pending process
        tenantDomain - tenant domain of user
        Returns:
        workflow pending request
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addSharedScope

        public String addSharedScope​(org.wso2.carbon.apimgt.api.model.Scope scope,
                                     String tenantDomain)
                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Add shared scope.
        Parameters:
        scope - Scope Object to add
        tenantDomain - Tenant domain
        Returns:
        UUID of the shared scope
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while adding shared scope
      • deleteSharedScope

        public void deleteSharedScope​(String scopeName,
                                      String tenantDomain)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete shared scope.
        Parameters:
        scopeName - shared scope name
        tenantDomain - tenant domain
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while removing shared scope
      • getSharedScopeKeyByUUID

        public String getSharedScopeKeyByUUID​(String uuid)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Get shared scope key by uuid.
        Parameters:
        uuid - UUID of shared scope
        Returns:
        Shared scope key
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while getting shared scope
      • getSharedScopeUsage

        public org.wso2.carbon.apimgt.api.model.SharedScopeUsage getSharedScopeUsage​(String uuid,
                                                                                     int tenantId)
                                                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the API and URI usages of the given shared scope
        Parameters:
        uuid - Id of the shared scope
        tenantId - tenant Id
        Returns:
        usgaes ofr the shaerd scope
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If an error occurs while getting the usage details
      • isSharedScopeExists

        public boolean isSharedScopeExists​(String scopeName,
                                           int tenantId)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Checks whether the given shared scope name is already available under given tenant domain.
        Parameters:
        scopeName - Scope Name
        tenantId - Tenant ID
        Returns:
        scope name availability
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - If an error occurs while checking the availability
      • getAllSharedScopeKeys

        public Set<String> getAllSharedScopeKeys​(String tenantDomain)
                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all shared scope keys for tenant.
        Parameters:
        tenantDomain - Tenant Domain
        Returns:
        shared scope list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while getting all shared scopes for tenant
      • getAllSharedScopes

        public List<org.wso2.carbon.apimgt.api.model.Scope> getAllSharedScopes​(String tenantDomain)
                                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Get all shared scopes for tenant.
        Parameters:
        tenantDomain - Tenant Domain
        Returns:
        shared scope list
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while getting all shared scopes for tenant
      • addTenantTheme

        public void addTenantTheme​(int tenantId,
                                   InputStream themeContent)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds a tenant theme to the database
        Parameters:
        tenantId - tenant ID of user
        themeContent - content of the tenant theme
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a tenant theme to the database
      • updateTenantTheme

        public void updateTenantTheme​(int tenantId,
                                      InputStream themeContent)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Updates an existing tenant theme in the database
        Parameters:
        tenantId - tenant ID of user
        themeContent - content of the tenant theme
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when updating an existing tenant theme in the database
      • getTenantTheme

        public InputStream getTenantTheme​(int tenantId)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieves a tenant theme from the database
        Parameters:
        tenantId - tenant ID of user
        Returns:
        content of the tenant theme
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when retrieving a tenant theme from the database
      • isTenantThemeExist

        public boolean isTenantThemeExist​(int tenantId)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Checks whether a tenant theme exist for a particular tenant
        Parameters:
        tenantId - tenant ID of user
        Returns:
        true if a tenant theme exist for a particular tenant ID, false otherwise
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when determining whether a tenant theme exists for a given tenant ID
      • deleteTenantTheme

        public void deleteTenantTheme​(int tenantId)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Deletes a tenant theme from the database
        Parameters:
        tenantId - tenant ID of user
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when deleting a tenant theme from the database
      • getAPIVersions

        public Set<String> getAPIVersions​(String apiName,
                                          String apiProvider,
                                          String organization)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Return the existing versions for the given api name for the provider
        Parameters:
        apiName - api name
        apiProvider - provider
        organization - identifier of the organization
        Returns:
        set version
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAllAPIVersions

        public List<org.wso2.carbon.apimgt.api.model.API> getAllAPIVersions​(String apiName,
                                                                            String apiProvider)
                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Return ids of the versions for the given name for the given provider
        Parameters:
        apiName - api name
        apiProvider - provider
        Returns:
        set ids
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getRevisionCountByAPI

        public int getRevisionCountByAPI​(String apiUUID)
                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Get count of the revisions created for a particular API.
        Returns:
        revision count
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision count
      • getMostRecentRevisionId

        public int getMostRecentRevisionId​(String apiUUID)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Get most recent revision id of the revisions created for a particular API.
        Returns:
        revision id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision id
      • getLatestRevisionUUID

        public String getLatestRevisionUUID​(String apiUUID)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the latest revision UUID from the revision list for a given API
        Parameters:
        apiUUID - UUID of the API
        Returns:
        UUID of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • addAPIRevision

        public void addAPIRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds an API revision record to the database
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • getRevisionByRevisionUUID

        public org.wso2.carbon.apimgt.api.model.APIRevision getRevisionByRevisionUUID​(String revisionUUID)
                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get revision details by providing revision UUID
        Returns:
        revision object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • getRevisionUUID

        public String getRevisionUUID​(String revisionNum,
                                      String apiUUID)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get revision UUID providing revision number
        Parameters:
        revisionNum - Revision number
        apiUUID - UUID of the API
        Returns:
        UUID of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • getRevisionUUIDByOrganization

        public String getRevisionUUIDByOrganization​(String revisionNum,
                                                    String apiUUID,
                                                    String organization)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Get revision UUID providing revision number and organization
        Parameters:
        revisionNum - Revision number
        apiUUID - UUID of the API
        organization - organization ID of the API
        Returns:
        UUID of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • getEarliestRevision

        public String getEarliestRevision​(String apiUUID)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the earliest revision UUID from the revision list for a given API
        Parameters:
        apiUUID - UUID of the API
        Returns:
        UUID of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • getRevisionsListByAPIUUID

        public List<org.wso2.carbon.apimgt.api.model.APIRevision> getRevisionsListByAPIUUID​(String apiUUID)
                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get revision details by providing revision UUID
        Returns:
        revisions List object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • checkAPIUUIDIsARevisionUUID

        public org.wso2.carbon.apimgt.api.model.APIRevision checkAPIUUIDIsARevisionUUID​(String apiUUID)
                                                                                 throws org.wso2.carbon.apimgt.api.APIManagementException
        Get a provided api uuid is in the revision db table
        Returns:
        String apiUUID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while checking revision table
      • addAPIRevisionDeployment

        public void addAPIRevisionDeployment​(String apiRevisionId,
                                             List<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> apiRevisionDeployments)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds an API revision Deployment mapping record to the database
        Parameters:
        apiRevisionId - uuid of the revision
        apiRevisionDeployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • addDeployedAPIRevision

        public void addDeployedAPIRevision​(String apiRevisionId,
                                           List<org.wso2.carbon.apimgt.api.model.DeployedAPIRevision> deployedAPIRevisionList)
                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds an deployed API revision to the database
        Parameters:
        deployedAPIRevisionList - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • getAPIRevisionDeploymentByNameAndRevsionID

        public org.wso2.carbon.apimgt.api.model.APIRevisionDeployment getAPIRevisionDeploymentByNameAndRevsionID​(String name,
                                                                                                                 String revisionId)
                                                                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Get APIRevisionDeployment details by providing deployment name and revision uuid
        Returns:
        APIRevisionDeployment object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision details
      • getAPIRevisionDeploymentByRevisionUUID

        public List<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> getAPIRevisionDeploymentByRevisionUUID​(String revisionUUID)
                                                                                                            throws org.wso2.carbon.apimgt.api.APIManagementException
        Get APIRevisionDeployment details by providing revision uuid
        Returns:
        List object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision deployment mapping details
      • getAPIRevisionDeploymentByApiUUID

        public List<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> getAPIRevisionDeploymentByApiUUID​(String apiUUID)
                                                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Get APIRevisionDeployment details by providing API uuid
        Returns:
        List object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision deployment mapping details
      • getAPIRevisionDeploymentsByApiUUID

        public List<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> getAPIRevisionDeploymentsByApiUUID​(String apiUUID)
                                                                                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Get APIRevisionDeployment details by providing ApiUUID
        Returns:
        List object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision deployment mapping details
      • getDeployedAPIRevisionByApiUUID

        public List<org.wso2.carbon.apimgt.api.model.DeployedAPIRevision> getDeployedAPIRevisionByApiUUID​(String apiUUID)
                                                                                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Get DeployedAPIRevision details by providing ApiUUID
        Returns:
        List object
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs while retrieving revision deployment mapping details
      • removeAPIRevisionDeployment

        public void removeAPIRevisionDeployment​(String apiRevisionId,
                                                List<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> apiRevisionDeployments)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Remove an API revision Deployment mapping record to the database
        Parameters:
        apiRevisionId - uuid of the revision
        apiRevisionDeployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • removeAPIRevisionDeployment

        public void removeAPIRevisionDeployment​(String apiUUID,
                                                Set<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> deployments)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Remove an API revision Deployment mapping record to the database
        Parameters:
        apiUUID - uuid of the revision
        deployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • removeDeployedAPIRevision

        public void removeDeployedAPIRevision​(String apiUUID,
                                              Set<org.wso2.carbon.apimgt.api.model.DeployedAPIRevision> deployments)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Remove an deployed API revision in the database
        Parameters:
        apiUUID - uuid of the revision
        deployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • setUnDeployedAPIRevision

        public void setUnDeployedAPIRevision​(String apiUUID,
                                             Set<org.wso2.carbon.apimgt.api.model.DeployedAPIRevision> deployments)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Set the deployed time of the un-deployed revision entry as NULL
        Parameters:
        apiUUID - uuid of the revision
        deployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • updateAPIRevisionDeployment

        public void updateAPIRevisionDeployment​(String apiUUID,
                                                Set<org.wso2.carbon.apimgt.api.model.APIRevisionDeployment> deployments)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Update API revision Deployment mapping record
        Parameters:
        apiUUID - API UUID
        deployments - content of the revision deployment mapping objects
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • restoreAPIRevision

        public void restoreAPIRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Restore API revision database records as the Current API of an API
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when restoring an API revision
      • deleteAPIRevision

        public void deleteAPIRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Restore API revision database records as the Current API of an API
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when restoring an API revision
      • addAPIProductRevision

        public void addAPIProductRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Adds an API Product revision record to the database
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when adding a new API revision
      • restoreAPIProductRevision

        public void restoreAPIProductRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Restore API Product revision database records as the Current API Product of an API Product
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when restoring an API revision
      • deleteAPIProductRevision

        public void deleteAPIProductRevision​(org.wso2.carbon.apimgt.api.model.APIRevision apiRevision)
                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete API Product revision database records
        Parameters:
        apiRevision - content of the revision
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException - if an error occurs when restoring an API revision
      • setServiceStatusInfoToAPI

        public void setServiceStatusInfoToAPI​(org.wso2.carbon.apimgt.api.model.API api,
                                              int apiId)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve Service Info and Set it to API
        Parameters:
        api - API Object
        apiId - Internal Unique API Id
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • retrieveServiceKeyByApiId

        public String retrieveServiceKeyByApiId​(int apiId,
                                                int tenantId)
                                         throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve the Unique Identifier of the Service used in API
        Parameters:
        apiId - Unique Identifier of API
        tenantId - Tenant ID
        Returns:
        Service Key
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLightweightApplicationByConsumerKey

        public org.wso2.carbon.apimgt.api.model.ApplicationInfo getLightweightApplicationByConsumerKey​(String consumerKey)
                                                                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getSubscribedAPIsByApplication

        public Set<org.wso2.carbon.apimgt.api.model.SubscribedAPI> getSubscribedAPIsByApplication​(org.wso2.carbon.apimgt.api.model.Application application)
                                                                                           throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getPaginatedSubscribedAPIsByApplication

        public Set<org.wso2.carbon.apimgt.api.model.SubscribedAPI> getPaginatedSubscribedAPIsByApplication​(org.wso2.carbon.apimgt.api.model.Application application,
                                                                                                           Integer offset,
                                                                                                           Integer limit,
                                                                                                           String organization)
                                                                                                    throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addOperationPolicyMapping

        public void addOperationPolicyMapping​(Set<org.wso2.carbon.apimgt.api.model.URITemplate> uriTemplates)
                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • hasApplicationPolicyAttachedToApplication

        public boolean hasApplicationPolicyAttachedToApplication​(String policyName,
                                                                 String organization)
                                                          throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • hasSubscriptionPolicyAttached

        public boolean hasSubscriptionPolicyAttached​(String policyName,
                                                     String organization)
                                              throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • hasAPIPolicyAttached

        public boolean hasAPIPolicyAttached​(String policyName,
                                            String organization)
                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addCommonOperationPolicy

        public String addCommonOperationPolicy​(org.wso2.carbon.apimgt.api.model.OperationPolicyData policyData)
                                        throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a new common operation policy to the database. This will first add the operation policy content to the AM_OPERATION_POLICY table and another entry to AM_COMMON_OPERATION_POLICY table.
        Parameters:
        policyData - Operation policy data.
        Returns:
        UUID of the newly created shared policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • addAPISpecificOperationPolicy

        public String addAPISpecificOperationPolicy​(String apiUUID,
                                                    String revisionUUID,
                                                    org.wso2.carbon.apimgt.api.model.OperationPolicyData policyData)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Add a new API specific operation policy to the database
        Parameters:
        apiUUID - Unique Identifier of API
        revisionUUID - Unique Identifier of API revision
        policyData - Unique Identifier of API
        Returns:
        UUID of the newly created shared policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • updateOperationPolicy

        public void updateOperationPolicy​(String policyId,
                                          org.wso2.carbon.apimgt.api.model.OperationPolicyData policyData)
                                   throws org.wso2.carbon.apimgt.api.APIManagementException
        Update an existing operation policy
        Parameters:
        policyId - Shared policy UUID
        policyData - Updated policy definition
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • deleteOperationPolicyByPolicyId

        public void deleteOperationPolicyByPolicyId​(String policyId)
                                             throws org.wso2.carbon.apimgt.api.APIManagementException
        Delete an operation policy by providing the policy UUID
        Parameters:
        policyId - UUID of the policy to be deleted
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getURITemplatesWithOperationPolicies

        public Set<org.wso2.carbon.apimgt.api.model.URITemplate> getURITemplatesWithOperationPolicies​(String apiUUID)
                                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the set of URI templates that have Operation policies
        Parameters:
        apiUUID - Unique Identifier of API
        Returns:
        URITemplate set
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • cloneAPISpecificPoliciesForVersioning

        public boolean cloneAPISpecificPoliciesForVersioning​(String previousAPIVersionUUID,
                                                             String newAPIVersionUUID,
                                                             String organization,
                                                             List<org.wso2.carbon.apimgt.api.dto.ClonePolicyMetadataDTO> clonePolicyMetadata)
                                                      throws org.wso2.carbon.apimgt.api.APIManagementException
        A clone of API specific will be taken and cloned when a new version is created.
        Parameters:
        previousAPIVersionUUID - The UUID of the original API
        newAPIVersionUUID - The UUID of the newly created API version
        organization - The API uuid which the cloned policy will be assigned to
        Returns:
        cloned policyID
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
        SQLException
      • getAPISpecificOperationPolicyByPolicyID

        public org.wso2.carbon.apimgt.api.model.OperationPolicyData getAPISpecificOperationPolicyByPolicyID​(String policyId,
                                                                                                            String apiUUID,
                                                                                                            String organization,
                                                                                                            boolean isWithPolicyDefinition)
                                                                                                     throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the API specific operation policy from the policy ID if exists. This method will take the intersection of AM_OPERATION_POLICY table and AM_API_OPERATION_POLICY table from API UUID. Policy id might be available, but if it is not referenced in the APIS table, this will return null. The returned policy data can be either an API only policy, cloned common policy to API or a revisioned API specific policy
        Parameters:
        policyId - Policy UUID
        apiUUID - UUID of the API
        organization - Organization name
        isWithPolicyDefinition - Include the policy definition to the output or not
        Returns:
        operation policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • populatePolicyDefinitions

        public void populatePolicyDefinitions​(Connection connection,
                                              String policyId,
                                              org.wso2.carbon.apimgt.api.model.OperationPolicyData policyData)
                                       throws SQLException
        Throws:
        SQLException
      • getCommonOperationPolicyByPolicyID

        public org.wso2.carbon.apimgt.api.model.OperationPolicyData getCommonOperationPolicyByPolicyID​(String policyId,
                                                                                                       String organization,
                                                                                                       boolean isWithPolicyDefinition)
                                                                                                throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the common operation policy from the policy ID if exists. This method will take the intersection of AM_OPERATION_POLICY table and AM_COMMON_OPERATION_POLICY table. Policy id might be available, but if it is not referenced in the common policies table, this will return null.
        Parameters:
        policyId - Policy UUID
        organization - Organization name
        isWithPolicyDefinition - Include the policy definition to the output or not
        Returns:
        operation policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getCommonOperationPolicyByPolicyName

        public org.wso2.carbon.apimgt.api.model.OperationPolicyData getCommonOperationPolicyByPolicyName​(String policyName,
                                                                                                         String policyVersion,
                                                                                                         String organization,
                                                                                                         boolean isWithPolicyDefinition)
                                                                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve a common operation policy by providing the policy name and organization
        Parameters:
        policyName - Policy name
        policyVersion - Policy version
        organization - Organization name
        isWithPolicyDefinition - Include the policy definition to the output or not
        Returns:
        operation policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getAPISpecificOperationPolicyByPolicyName

        public org.wso2.carbon.apimgt.api.model.OperationPolicyData getAPISpecificOperationPolicyByPolicyName​(String policyName,
                                                                                                              String policyVersion,
                                                                                                              String apiUUID,
                                                                                                              String revisionUUID,
                                                                                                              String organization,
                                                                                                              boolean isWithPolicyDefinition)
                                                                                                       throws org.wso2.carbon.apimgt.api.APIManagementException
        Retrieve an API Specific operation policy by providing the policy name. In order to narrow down the specific policy this needs policy name, apiUUID, api revision UUID (if exists) and organization. If revision UUID is not provided, that means the policy is not a revisioned policy.
        Parameters:
        policyName - Policy name
        apiUUID - UUID of API
        revisionUUID - UUID of API revision
        organization - Organization name
        isWithPolicyDefinition - Include the policy definition to the output or not
        Returns:
        operation policy
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getLightWeightVersionOfAllOperationPolicies

        public List<org.wso2.carbon.apimgt.api.model.OperationPolicyData> getLightWeightVersionOfAllOperationPolicies​(String apiUUID,
                                                                                                                      String organization)
                                                                                                               throws org.wso2.carbon.apimgt.api.APIManagementException
        Get the list of all operation policies. If the API UUID is provided, this will return all the operation policies for that API. If not, it will return the common operation policies which are not bound to any API. This list will include policy specification of each policy and policy ID. It will not contain the policy definition as it is not useful for the operation.
        Parameters:
        apiUUID - UUID of the API if exists. Null for common operation policies
        organization - Organization name
        Returns:
        List of Operation Policies
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException
      • getCommonOperationPolicyNames

        public Set<String> getCommonOperationPolicyNames​(String organization)
                                                  throws org.wso2.carbon.apimgt.api.APIManagementException
        Throws:
        org.wso2.carbon.apimgt.api.APIManagementException