Search in sources :

Example 1 with PageType

use of io.gravitee.rest.api.model.PageType in project gravitee-management-rest-api by gravitee-io.

the class PageRevisionServiceImpl method create.

@Override
public PageRevisionEntity create(Page page) {
    try {
        logger.debug("Create page revision for page {}", page.getId());
        PageType type = PageType.valueOf(page.getType());
        if (!(type == PageType.MARKDOWN || type == PageType.SWAGGER || type == PageType.TRANSLATION)) {
            throw new TechnicalManagementException("Invalid page type for revision");
        }
        PageRevision revision = pageRevisionRepository.create(convert(page));
        return convert(revision);
    } catch (TechnicalException e) {
        logger.warn("An error occurs while trying to create a revision for page {}", page.getId(), e);
        throw new TechnicalManagementException("An error occurs while trying to create a page revision", e);
    }
}
Also used : TechnicalException(io.gravitee.repository.exceptions.TechnicalException) PageRevision(io.gravitee.repository.management.model.PageRevision) PageType(io.gravitee.rest.api.model.PageType) TechnicalManagementException(io.gravitee.rest.api.service.exceptions.TechnicalManagementException)

Aggregations

TechnicalException (io.gravitee.repository.exceptions.TechnicalException)1 PageRevision (io.gravitee.repository.management.model.PageRevision)1 PageType (io.gravitee.rest.api.model.PageType)1 TechnicalManagementException (io.gravitee.rest.api.service.exceptions.TechnicalManagementException)1