private void addActionChildren(grdLimbWeightRow parentRow, TreeNode[] children, StrengtheningProgramMovementCollection voMovementColl, boolean bAddValues, StrengtheningProgramVo voStrengtheningProgram) { if (parentRow == null || children == null) return; for (int i = 0; i < parentRow.getRows().size(); i++) { Object value = parentRow.getRows().get(i).getValue(); if (value instanceof StrengtheningProgramLimbType) { if (parentRow.getRows().get(i).getRows().size() == 0) { addActions(parentRow.getRows().get(i), voMovementColl, bAddValues, voStrengtheningProgram); parentRow.getRows().get(i).setExpanded(true); } else { StrengtheningProgramLimbType lkpItem = (StrengtheningProgramLimbType) value; if (lkpItem.getChildren() != null && lkpItem.getChildren().length > 0) addActionChildren(parentRow.getRows().get(i), lkpItem.getChildren(), voMovementColl, bAddValues, voStrengtheningProgram); } } } }
private void populateAuthoringInfo(StrengtheningProgramVo voStrengtheningProgram) { if (voStrengtheningProgram != null) { AuthoringInformationVo voAuthoringInformation = voStrengtheningProgram.getAuthoringInformation(); if (voAuthoringInformation != null) { form.dtimAuthoring().setValue(voAuthoringInformation.getAuthoringDateTime()); if (voAuthoringInformation.getAuthoringHcpIsNotNull()) { form.qmbHCP().newRow(voAuthoringInformation.getAuthoringHcp(), voAuthoringInformation.getAuthoringHcp().toString()); form.qmbHCP().setValue(voAuthoringInformation.getAuthoringHcp()); } } } }
private void populateExerciseGrid(StrengtheningProgramVo voStrengtheningProgram) { if (voStrengtheningProgram == null) return; for (int i = 0; i < voStrengtheningProgram.getExcercise().size(); i++) { for (int j = 0; j < form.grdPlinth().getRows().size(); j++) { if (form.grdPlinth().getRows().get(j).getValue().equals(voStrengtheningProgram.getExcercise().get(i))) { form.grdPlinth().getRows().get(j).setColSelect(true); break; } } } }
/** * save StrenghteningProgram * @throws UniqueKeyViolationException */ public ims.therapies.vo.StrengtheningProgramVo saveStrenghteningProgram(ims.therapies.vo.StrengtheningProgramVo voStrenghteningProgram) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException { if (voStrenghteningProgram == null) throw new RuntimeException("Cannot save null StrengtheningProgramVo."); if (voStrenghteningProgram.isValidated() == false) throw new CodingRuntimeException("StrengtheningProgramVo is not validated"); DomainFactory factory = getDomainFactory(); if (voStrenghteningProgram.getID_StrengtheningProgram() == null)//Inserting a record { StrengtheningProgramVo voSP = getStrengthProgByClinicalContact(voStrenghteningProgram.getClinicalContact()); if(voSP != null) throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed"); } StrengtheningProgram doStregtheningProgram = StrengtheningProgramVoAssembler.extractStrengtheningProgram(factory, voStrenghteningProgram); factory.save(doStregtheningProgram); return StrengtheningProgramVoAssembler.create(doStregtheningProgram); }
public StrengtheningProgramVo getStrenghteningProgram(CareContextRefVo careContextRefVo) { if (careContextRefVo == null) throw new CodingRuntimeException("Cannot get CareContextRefVo CareContextRefVo "); DomainFactory factory = getDomainFactory(); String hql = " from StrengtheningProgram sp where sp.clinicalContact.careContext.id = :clinContactId"; ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); names.add("clinContactId"); values.add(careContextRefVo.getID_CareContext()); List list = factory.find(hql, names, values); int listSize = list.size(); if (listSize == 1) return StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(list).get(0); if (listSize > 1) throw new RuntimeException("More than one record for the current Clinical Contact exists."); return null; }
private void addActions(grdLimbWeightRow parentRow, StrengtheningProgramMovementCollection voMovementColl, boolean bAddValues, StrengtheningProgramVo voStrengtheningProgram) { if (parentRow == null || voMovementColl == null) return; for (int i = 0; i < voMovementColl.size(); i++) { grdLimbWeightRow childRow = parentRow.getRows().newRow(); childRow.setColLimbWeight(voMovementColl.get(i).toString()); childRow.setValue(voMovementColl.get(i)); if(bAddValues && voStrengtheningProgram!=null){ for (int k = 0; voStrengtheningProgram.getLimbWeightIsNotNull() && k < voStrengtheningProgram.getLimbWeight().size(); k++) { StrengtheningProgramLimbWeightVo voLimbWeightVo = voStrengtheningProgram.getLimbWeight().get(k); boolean sameType = childRow.getParentRow() != null && childRow.getParentRow().getValue() != null && childRow.getParentRow().getValue().equals(voLimbWeightVo.getLimbType()); boolean sameAction = childRow.getValue() != null && childRow.getValue().equals(voLimbWeightVo.getAction()); if (sameType && sameAction){ childRow.setColKgs(voLimbWeightVo.getKgs()); childRow.setColReps(voLimbWeightVo.getRepetitions()); } } } } }
protected void populateScreenFromData(StrengtheningProgramVo voStrengtheningProgram) { super.populateScreenFromData(voStrengtheningProgram); populateAuthoringInfo(voStrengtheningProgram); populateLimbGrid(voStrengtheningProgram); populateExerciseGrid(voStrengtheningProgram); form.getLocalContext().setStrengtheningProgramVo(voStrengtheningProgram); }
protected StrengtheningProgramVo populateDataFromScreen(StrengtheningProgramVo voStrengtheningProgram) { voStrengtheningProgram.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); populateAuthoringData(voStrengtheningProgram); populateLimbsDataFromGrid(voStrengtheningProgram); populateExercises(voStrengtheningProgram); return super.populateDataFromScreen(voStrengtheningProgram); }
private void populateAuthoringData(StrengtheningProgramVo voStrengtheningProgram) { AuthoringInformationVo voAuthoringInformation = new AuthoringInformationVo(); voAuthoringInformation.setAuthoringDateTime(form.dtimAuthoring().getValue()); voAuthoringInformation.setAuthoringHcp(form.qmbHCP().getValue()); voStrengtheningProgram.setAuthoringInformation(voAuthoringInformation); }
private void populateLimbsDataFromGrid(StrengtheningProgramVo voStrengtheningProgram) { StrengtheningProgramLimbWeightVoCollection voColl = new StrengtheningProgramLimbWeightVoCollection(); getTreeRow(form.grdLimbWeight().getRows(), voColl); voStrengtheningProgram.setLimbWeight(voColl); }
private void populateExercises(StrengtheningProgramVo voStrengtheningProgram) { ims.spinalinjuries.vo.lookups.StrengtheningProgramExerciseCollection lookupColl = new ims.spinalinjuries.vo.lookups.StrengtheningProgramExerciseCollection(); for (int i = 0; i < form.grdPlinth().getRows().size(); i++) { if (form.grdPlinth().getRows().get(i).getColSelect()) lookupColl.add(form.grdPlinth().getRows().get(i).getValue()); } voStrengtheningProgram.setExcercise(lookupColl); }
private boolean isAuthoringHcpEnableable() { StrengtheningProgramVo voStrengtheningProgram = form.getLocalContext().getStrengtheningProgramVo(); if (voStrengtheningProgram != null && voStrengtheningProgram.getID_StrengtheningProgramIsNotNull()) { return voStrengtheningProgram.getAuthoringInformation() == null; } return true; }
private boolean isAuthoringDtimEnableable() { StrengtheningProgramVo voStrengtheningProgram = form.getLocalContext().getStrengtheningProgramVo(); if (voStrengtheningProgram != null && voStrengtheningProgram.getID_StrengtheningProgramIsNotNull()) { return voStrengtheningProgram.getAuthoringInformation() == null; } return true; }
public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from StrengtheningProgram sp "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voClinicalContactRefVo != null) { hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(voClinicalContactRefVo.getID_ClinicalContact()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List skills = factory.find(query, markers, values); StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills); if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0) return collStrengtheningProgramVo.get(0); return null; }