Search in sources :

Example 6 with AsyncSpecPersistenceException

use of org.wso2.carbon.apimgt.persistence.exceptions.AsyncSpecPersistenceException in project carbon-apimgt by wso2.

the class APIProviderImpl method saveAsyncApiDefinition.

@Override
public void saveAsyncApiDefinition(API api, String jsonText) throws APIManagementException {
    String apiId;
    String organization = api.getOrganization();
    if (api.getUuid() != null) {
        apiId = api.getUuid();
    } else if (api.getId().getUUID() != null) {
        apiId = api.getId().getUUID();
    } else {
        apiId = apiMgtDAO.getUUIDFromIdentifier(api.getId().getProviderName(), api.getId().getApiName(), api.getId().getVersion(), organization);
    }
    try {
        apiPersistenceInstance.saveAsyncDefinition(new Organization(organization), apiId, jsonText);
    } catch (AsyncSpecPersistenceException e) {
        throw new APIManagementException("Error while persisting Async API definition ", e);
    }
}
Also used : AsyncSpecPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.AsyncSpecPersistenceException) Organization(org.wso2.carbon.apimgt.persistence.dto.Organization) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException)

Aggregations

Organization (org.wso2.carbon.apimgt.persistence.dto.Organization)4 AsyncSpecPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.AsyncSpecPersistenceException)4 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)3 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)3 APIPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException)3 GenericArtifactManager (org.wso2.carbon.governance.api.generic.GenericArtifactManager)3 GenericArtifact (org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact)3 Registry (org.wso2.carbon.registry.core.Registry)3 Resource (org.wso2.carbon.registry.core.Resource)3 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)3 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 JSONObject (org.json.simple.JSONObject)1 JSONParser (org.json.simple.parser.JSONParser)1 ParseException (org.json.simple.parser.ParseException)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1