/** * Function used to populate instance controls with data */ private void populateInstanceControls(ResultCommentsVo comment) { // Clear instance controls clearInstanceControls(); // Check parameter for null value if (comment == null) return; // Set value into controls form.ctnDetails().ccAutoringInfo().setValue(comment.getAuthoringInformation()); form.ctnDetails().txtComments().setValue(comment.getComment()); form.ctnDetails().ccCorrectingHCP().setValue(comment.getCorrectingHcp()); form.ctnDetails().dtimCorrectedDateTime().setValue(comment.getCorrectingDateTime()); form.ctnDetails().txtCorrectionReason().setValue(comment.getCorrectionReason()); }
public ResultCommentsVo saveEdit(ResultCommentsVo comment) throws ims.domain.exceptions.StaleObjectException { if (comment == null) throw new DomainRuntimeException("Can not save empty record."); if (!comment.isValidated()) throw new DomainRuntimeException("Record to save is not validated."); DomainFactory factory = getDomainFactory(); ResultConclusionAndActionComment domComment = ResultCommentsVoAssembler.extractResultConclusionAndActionComment(factory, comment); // Check for stale comment (deleted) if (domComment == null) throw new StaleObjectException(domComment); factory.save(domComment); return ResultCommentsVoAssembler.create(domComment); }
public void removeComment(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null) throw new DomainRuntimeException("Can not remove comment from null parent."); if (Category.PATHOLOGY.equals(result.getCategory())) { removeComentFromOrderSpecimen(result, comment); return; } if (Category.CLINICALIMAGING.equals(result.getCategory())) { removeCommentFromOrderInvestigation(result, comment); return; } return; }
private void removeCommentFromOrderInvestigation(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not remove comment from null parent."); if (comment == null || !comment.getID_ResultConclusionAndActionCommentIsNotNull()) throw new DomainRuntimeException("Can not remove unsaved comment."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = (ResultConclusionAndActionComment) factory.getDomainObject(ResultConclusionAndActionComment.class, comment.getID_ResultConclusionAndActionComment()); // Check for stale comment (deleted or edited) if (domComment == null || domComment.getVersion() > comment.getVersion_ResultConclusionAndActionComment()) throw new StaleObjectException(domComment); OrderInvestigation domOrderInv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); // Remove comment from order investigation comments domOrderInv.getResultConclusionComments().remove(domComment); factory.delete(domComment); factory.save(domOrderInv); return; }
/** * Function used to populate the grid with comments from a collection */ private void populateCommentsGrid(ResultCommentsVoCollection commentCollection) { // Clear grid form.grdComments().getRows().clear(); // Check parameter for null collection if (commentCollection == null) return; // Iterate comments collection and add each collection for (ResultCommentsVo comment : commentCollection) { grdCommentsRow row = form.grdComments().getRows().newRow(); row.setColAuthorDate(comment.getAuthoringInformation().getAuthoringDateTime().toString()); row.setColAuthorHCP(comment.getAuthoringInformation().getAuthoringHcp().toString()); row.setColComment(comment.getComment()); row.setTooltipForColComment(comment.getComment()); if (comment.getCorrectingHcpIsNotNull() && comment.getCorrectingDateTimeIsNotNull()) { row.setTextColor(Color.Gray); } row.setValue(comment); } }
public ResultCommentsVo getComment(ResultConclusionAndActionCommentRefVo comment) { if (comment == null || !comment.getID_ResultConclusionAndActionCommentIsNotNull()) return null; return ResultCommentsVoAssembler.create((ResultConclusionAndActionComment) getDomainFactory().getDomainObject(ResultConclusionAndActionComment.class, comment.getID_ResultConclusionAndActionComment())); }
@SuppressWarnings("unchecked") private ResultCommentsVo saveNewCommentToOrderInvestigation(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not add comment to null parent."); if (comment == null) throw new DomainRuntimeException("Can not save null comment record."); if (!comment.isValidated()) throw new DomainRuntimeException("Comment record is not validated."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domainComment = ResultCommentsVoAssembler.extractResultConclusionAndActionComment(factory, comment); // Commit comment to data base factory.save(domainComment); // Get order investigation from data base OrderInvestigation domOrderInvestigation = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); domOrderInvestigation.getResultConclusionComments().add(domainComment); factory.save(domOrderInvestigation); // Return saved comment return ResultCommentsVoAssembler.create(domainComment); }
@SuppressWarnings("unchecked") private ResultCommentsVo saveNewCommentToOrderSpecimen(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not add comment to null parent"); if (comment == null) throw new DomainRuntimeException("Can not save null comment record."); if (!comment.isValidated()) throw new DomainRuntimeException("Comment record is not validated"); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = ResultCommentsVoAssembler.extractResultConclusionAndActionComment(factory, comment); // Commit comment to data base factory.save(domComment); // Get order investigation from data base OrderInvestigation domOrderInvestigation = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); // Get specimen domain object OrderSpecimen domSpecimen = (OrderSpecimen) domOrderInvestigation.getSpecimen().get(0); domSpecimen.getResultConclusionComments().add(domComment); factory.save(domSpecimen); // Return saved comment return ResultCommentsVoAssembler.create(domComment); }
private void removeComentFromOrderSpecimen(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) throw new DomainRuntimeException("Can not remove comment from null parent."); if (comment == null || !comment.getID_ResultConclusionAndActionCommentIsNotNull()) throw new DomainRuntimeException("Can not remove unsaved comment."); DomainFactory factory = getDomainFactory(); // Extract comment domain object ResultConclusionAndActionComment domComment = (ResultConclusionAndActionComment) factory.getDomainObject(ResultConclusionAndActionComment.class, comment.getID_ResultConclusionAndActionComment()); // Check for stale comment (deleted or edited) if (domComment == null || domComment.getVersion() > comment.getVersion_ResultConclusionAndActionComment()) throw new StaleObjectException(domComment); OrderInvestigation domOrderInv = (OrderInvestigation) factory.getDomainObject(OrderInvestigation.class, result.getOrderInvestigation().getID_OrderInvestigation()); OrderSpecimen domSpecimen = (OrderSpecimen) domOrderInv.getSpecimen().get(0); // Remove comment from order investigation comments domSpecimen.getResultConclusionComments().remove(domComment); factory.delete(domComment); factory.save(domOrderInv); return; }
public ResultCommentsVo saveNew(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException { if (result == null) throw new DomainRuntimeException("Can not add comment to null parent."); if (Category.PATHOLOGY.equals(result.getCategory())) return saveNewCommentToOrderSpecimen(result, comment); if (Category.CLINICALIMAGING.equals(result.getCategory()) || Category.CLINICAL.equals(result.getCategory())) //WDEV-16643 return saveNewCommentToOrderInvestigation(result, comment); return null; }