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); }
private ResultCommentsVoCollection listCommentsFromOrderInvestigation(OcsPathRadResultVo result) { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) return null; StringBuilder query = new StringBuilder(); query.append("SELECT comm FROM OrderInvestigation AS inv LEFT JOIN inv.resultConclusionComments AS comm "); query.append("WHERE inv.id = :INV_ID"); query.append(" order by comm.authoringInformation.authoringDateTime desc"); //WDEV-14077 return ResultCommentsVoAssembler.createResultCommentsVoCollectionFromResultConclusionAndActionComment(getDomainFactory().find(query.toString(), "INV_ID", result.getOrderInvestigation().getID_OrderInvestigation())); }
private ResultCommentsVoCollection listCommentsFromOrderSpeciment(OcsPathRadResultVo result) { if (result == null || !result.getOrderInvestigationIsNotNull() || !result.getOrderInvestigation().getID_OrderInvestigationIsNotNull()) return null; StringBuilder query = new StringBuilder(); query.append("SELECT comm FROM OrderInvestigation AS inv LEFT JOIN inv.specimen AS spec LEFT JOIN spec.resultConclusionComments AS comm "); query.append("WHERE inv.id = :INV_ID"); query.append(" order by comm.authoringInformation.authoringDateTime desc"); //WDEV-14077 return ResultCommentsVoAssembler.createResultCommentsVoCollectionFromResultConclusionAndActionComment(getDomainFactory().find(query.toString(), "INV_ID", result.getOrderInvestigation().getID_OrderInvestigation())); }
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); }