Search in sources :

Example 16 with DocumentationPersistenceException

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

the class AbstractAPIManager method getDocumentationContent.

@Override
public DocumentationContent getDocumentationContent(String apiId, String docId, String organization) throws APIManagementException {
    try {
        DocumentContent content = apiPersistenceInstance.getDocumentationContent(new Organization(organization), apiId, docId);
        DocumentationContent docContent = null;
        if (content != null) {
            docContent = DocumentMapper.INSTANCE.toDocumentationContent(content);
        } else {
            String msg = "Failed to get the document content. Artifact corresponding to document id " + docId + " does not exist";
            throw new APIMgtResourceNotFoundException(msg);
        }
        return docContent;
    } catch (DocumentationPersistenceException e) {
        throw new APIManagementException("Error while retrieving document content ", e);
    }
}
Also used : DocumentationContent(org.wso2.carbon.apimgt.api.model.DocumentationContent) Organization(org.wso2.carbon.apimgt.persistence.dto.Organization) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) DocumentContent(org.wso2.carbon.apimgt.persistence.dto.DocumentContent) DocumentationPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.DocumentationPersistenceException) APIMgtResourceNotFoundException(org.wso2.carbon.apimgt.api.APIMgtResourceNotFoundException)

Aggregations

DocumentationPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.DocumentationPersistenceException)16 GenericArtifactManager (org.wso2.carbon.governance.api.generic.GenericArtifactManager)10 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)10 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)10 APIPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException)9 GenericArtifact (org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact)9 Registry (org.wso2.carbon.registry.core.Registry)9 Documentation (org.wso2.carbon.apimgt.persistence.dto.Documentation)8 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)7 Resource (org.wso2.carbon.registry.core.Resource)5 Organization (org.wso2.carbon.apimgt.persistence.dto.Organization)4 GovernanceException (org.wso2.carbon.governance.api.exception.GovernanceException)4 ArrayList (java.util.ArrayList)3 DocumentContent (org.wso2.carbon.apimgt.persistence.dto.DocumentContent)3 DocumentSearchResult (org.wso2.carbon.apimgt.persistence.dto.DocumentSearchResult)3 DevPortalSearchContent (org.wso2.carbon.apimgt.persistence.dto.DevPortalSearchContent)2 DocumentSearchContent (org.wso2.carbon.apimgt.persistence.dto.DocumentSearchContent)2 PublisherSearchContent (org.wso2.carbon.apimgt.persistence.dto.PublisherSearchContent)2 ResourceFile (org.wso2.carbon.apimgt.persistence.dto.ResourceFile)2 SearchContent (org.wso2.carbon.apimgt.persistence.dto.SearchContent)2