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);
}
}
Aggregations