Tobias Jeger pushed to branch feature/visual-editing-psp1-CHANNELMGR-928 at cms-community / hippo-addon-channel-manager
Commits: e40d1188 by Tobias Jeger at 2016-10-12T15:40:29+02:00 CHANNELMGR-928 Rework after review - Improve Javadoc in DocumentsService - Remove "edit test document" button - Change log message to warning level - Extract reused variable - - - - - 3 changed files: - content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsService.java - content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsServiceImpl.java - content-service/src/main/java/org/onehippo/cms/channelmanager/content/util/EditingUtils.java Changes: ===================================== content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsService.java ===================================== --- a/content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsService.java +++ b/content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsService.java @@ -35,7 +35,7 @@ public interface DocumentsService { /** * Creates a draft version of a document and locks it for editing by the current CMS user. * - * If all goes well, the document's contents are returned. + * If all goes well, the document's content is returned. * * @param uuid UUID of the requested document (handle) * @param session user-authenticated JCR session for reading from the repository ===================================== content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsServiceImpl.java ===================================== --- a/content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsServiceImpl.java +++ b/content-service/src/main/java/org/onehippo/cms/channelmanager/content/service/DocumentsServiceImpl.java @@ -53,13 +53,14 @@ public class DocumentsServiceImpl implements DocumentsService { .orElseThrow(DocumentNotFoundException::new); final DocumentType docType = getDocumentType(handle, locale); final Document document = assembleDocument(uuid, handle, workflow, docType); + final EditingInfo editingInfo = document.getInfo().getEditingInfo(); - if (document.getInfo().getEditingInfo().getState() == EditingInfo.State.AVAILABLE) { + if (editingInfo.getState() == EditingInfo.State.AVAILABLE) { final Optional<Node> optionalDraft = EditingUtils.createDraft(workflow, handle); if (optionalDraft.isPresent()) { loadFields(document, optionalDraft.get(), docType); } else { - document.getInfo().getEditingInfo().setState(EditingInfo.State.UNAVAILABLE); + editingInfo.setState(EditingInfo.State.UNAVAILABLE); } } return document; ===================================== content-service/src/main/java/org/onehippo/cms/channelmanager/content/util/EditingUtils.java ===================================== --- a/content-service/src/main/java/org/onehippo/cms/channelmanager/content/util/EditingUtils.java +++ b/content-service/src/main/java/org/onehippo/cms/channelmanager/content/util/EditingUtils.java @@ -144,7 +144,7 @@ public class EditingUtils { final Session session = handle.getSession(); return Optional.of(document.getNode(session)); } catch (WorkflowException | RepositoryException | RemoteException e) { - log.debug("Problem retrieving draft node", e); + log.warn("Problem retrieving draft node", e); } return Optional.empty(); } View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/e40d11888f2074f0412d188318ba32bd87a7a5ed
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn