use of com.enonic.xp.page.PageNotFoundException in project xp by enonic.
the class UpdatePageCommand method execute.
public Content execute() {
final Content content = this.contentService.getById(this.params.getContent());
if (content == null) {
throw new ContentNotFoundException(this.params.getContent(), ContextAccessor.current().getBranch());
}
if (content.getPage() == null) {
throw new PageNotFoundException(this.params.getContent());
}
final EditablePage editablePage = new EditablePage(content.getPage());
this.params.getEditor().edit(editablePage);
final Page editedPage = editablePage.build();
if (editedPage.equals(content.getPage())) {
return content;
}
defaultValuesProcessor.applyDefaultValues(editedPage, content.getPage());
final UpdateContentParams params = new UpdateContentParams().contentId(this.params.getContent()).editor(edit -> edit.page = editedPage);
this.contentService.update(params);
return this.contentService.getById(this.params.getContent());
}
Aggregations