protected void onRecbrAssessmentsValueChanged() throws PresentationLogicException { WheelchairAssessmentVoCollection voWheelchairAssessment = null; //wdev-13410 WheelchairAssessmentVo tempVo = null; //wdev-13410 ClinicalContactShortVo voClinicalContactShort = form.recbrAssessments().getValue(); form.getLocalContext().setClinicalContact(voClinicalContactShort); voWheelchairAssessment = domain.getWheelchairAssessment(voClinicalContactShort.getID_ClinicalContact()); if(voWheelchairAssessment != null && voWheelchairAssessment.size() > 0) //wdev-13410 tempVo = voWheelchairAssessment.get(0); //wdev-13410 else tempVo = null; displayContactAssessment(tempVo, voClinicalContactShort); //wdev-13410 }
private void populatePowerChairGrid() { form.grdPowechair().getRows().clear(); WheelchairType wheelChairType = form.cmbChairType().getValue(); if(wheelChairType != null && wheelChairType.equals(WheelchairType.POWER)) { PowerchairSkillCollection voCollPowerchairSkills = LookupHelper.getPowerchairSkill(domain.getLookupService()); GenForm.grdPowechairRow rowPowechair = null; for(int i=0; i<voCollPowerchairSkills.size();i++) { rowPowechair = form.grdPowechair().getRows().newRow(); rowPowechair.setColPowerchairskills(voCollPowerchairSkills.get(i)); } } WheelchairAssessmentVo wheelchairAssessment = form.getLocalContext().getWheelchairAssessmentVo(); if(wheelchairAssessment != null && wheelchairAssessment.getID_WheelchairAssessmentIsNotNull()) populateWheelchairAssessment(wheelchairAssessment); }
public WheelchairAssessmentVo saveWheelchairAssessment(WheelchairAssessmentVo wheelchairAssessment) throws StaleObjectException, UniqueKeyViolationException { DomainFactory factory = getDomainFactory(); if (!wheelchairAssessment.isValidated()) { throw new DomainRuntimeException("This WheelchairAssessmentVo has not been validated"); } if (wheelchairAssessment.getID_WheelchairAssessment() == null)//Inserting a record { WheelchairAssessmentVoCollection voWA = getWheelchairAssessment(wheelchairAssessment.getClinicalContact().getID_ClinicalContact()); //wdev-13410 WheelchairAssessmentVo tempVo = null; //wdev-13410 if(voWA != null && voWA.size() > 0) //wdev-13410 { tempVo = voWA.get(0); } else { tempVo = null; } if(tempVo != null ) throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed"); } WheelchairAssessment domWheelchairAssessment = WheelchairAssessmentVoAssembler.extractWheelchairAssessment(factory, wheelchairAssessment); factory.save(domWheelchairAssessment); return WheelchairAssessmentVoAssembler.create(domWheelchairAssessment); }
private void populateScreenFromData(WheelchairAssessmentVo voWheelchairAssessment) { form.getLocalContext().setWheelchairAssessmentVo(voWheelchairAssessment); if(voWheelchairAssessment.getAuthoringCPIsNotNull()){ form.qmbHCP().newRow(voWheelchairAssessment.getAuthoringCP(), voWheelchairAssessment.getAuthoringCP().getName().toString()); form.qmbHCP().setValue(voWheelchairAssessment.getAuthoringCP()); } if(voWheelchairAssessment.getAuthoringDateTimeIsNotNull()) form.dtimRecording().setValue(voWheelchairAssessment.getAuthoringDateTime()); form.cmbChairType().setValue(voWheelchairAssessment.getChairTypeIsNotNull() ? voWheelchairAssessment.getChairType() : null); cmbChairTypeValueChanged(); boolean lkupFound; GenForm.grdSurfaceRow rowSurface; form.grdSurface().getRows().clear(); if(voWheelchairAssessment.getSurfaceDistanceIsNotNull()) for (int i = 0; i< voWheelchairAssessment.getSurfaceDistance().size(); i++) { WheelchairSurfaceDistanceVo voSurfaceDistance = voWheelchairAssessment.getSurfaceDistance().get(i); rowSurface = form.grdSurface().getRows().newRow(); rowSurface.setColSurface(voSurfaceDistance.getSurface()); if(voSurfaceDistance.getDistanceIsNotNull()) rowSurface.setColDistance(voSurfaceDistance.getDistance()); } populateWheelchairAssessment(voWheelchairAssessment); GenForm.grdSkillsRow rowSkills; if(voWheelchairAssessment.getWheelchairSkillsAssessIsNotNull()) for (int i = 0; i< voWheelchairAssessment.getWheelchairSkillsAssess().size(); i++) { WheelchairSkillsAssessmentVo voWheelchairSkills = voWheelchairAssessment.getWheelchairSkillsAssess().get(i); lkupFound = false; for(int j=0; j<form.grdSkills().getRows().size(); j++){ rowSkills = form.grdSkills().getRows().get(j); if(rowSkills.getColWheelchairSkills().equals(voWheelchairSkills.getWheelchairSkill())){ if(voWheelchairSkills.getWheelchairSkillAssLevelIsNotNull()){ if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.CONTINUOUSLYGOOD)) rowSkills.setColContgood(true); else if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.FAIR)) rowSkills.setColFair(true); else if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.POOR)) rowSkills.setColPoor(true); } lkupFound = true; } } if(!lkupFound){ rowSkills = form.grdSkills().getRows().newRow(); rowSkills.setColWheelchairSkills(voWheelchairSkills.getWheelchairSkill()); if(voWheelchairSkills.getWheelchairSkillAssLevelIsNotNull()){ if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.CONTINUOUSLYGOOD)) rowSkills.setColContgood(true); else if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.FAIR)) rowSkills.setColFair(true); else if(voWheelchairSkills.getWheelchairSkillAssLevel().equals(WheelchairSkillAssessedLevel.POOR)) rowSkills.setColPoor(true); } } } }
private void populateWheelchairAssessment(WheelchairAssessmentVo voWheelchairAssessment) { if(voWheelchairAssessment == null || voWheelchairAssessment.getPowerchairSkillsAssess() == null) return; boolean lkupFound; GenForm.grdPowechairRow rowPowerchair; if(voWheelchairAssessment.getPowerchairSkillsAssessIsNotNull()) for (int i = 0; i< voWheelchairAssessment.getPowerchairSkillsAssess().size(); i++) { PowerchairSkillsAssessmentVo voPowerchairSkills = voWheelchairAssessment.getPowerchairSkillsAssess().get(i); lkupFound = false; for(int j=0; j<form.grdPowechair().getRows().size(); j++){ rowPowerchair = form.grdPowechair().getRows().get(j); if(rowPowerchair.getColPowerchairskills().equals(voPowerchairSkills.getPowerchairSkill())){ if(voPowerchairSkills.getPowerchairSkillAssLevelIsNotNull()){ if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.INDEPENDENT)) rowPowerchair.setColIndependent(true); else if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.SUPERVISION)) rowPowerchair.setColSupervision(true); else if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.SAFE)) rowPowerchair.setColUnsafe(true); } lkupFound = true; } } if(!lkupFound){ rowPowerchair = form.grdPowechair().getRows().newRow(); rowPowerchair.setColPowerchairskills(voPowerchairSkills.getPowerchairSkill()); if(voPowerchairSkills.getPowerchairSkillAssLevelIsNotNull()){ if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.INDEPENDENT)) rowPowerchair.setColIndependent(true); else if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.SUPERVISION)) rowPowerchair.setColSupervision(true); else if(voPowerchairSkills.getPowerchairSkillAssLevel().equals(PowerchairSkillAssessedLevel.SAFE)) rowPowerchair.setColUnsafe(true); } } } }
private WheelchairAssessmentVo populateDataFromScreem(WheelchairAssessmentVo voWheelchairAssessment) { if(voWheelchairAssessment.getClinicalContact()==null) voWheelchairAssessment.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voWheelchairAssessment.setAuthoringCP(form.qmbHCP().getValue()); if(form.dtimRecording().getValue() == null || form.dtimRecording().getValue().getDate()==null){ engine.showMessage("Please enter Date and Time."); return null; } if(form.dtimRecording().getValue().getTime()==null){ engine.showMessage("Please enter Time."); return null; } voWheelchairAssessment.setAuthoringDateTime(form.dtimRecording().getValue()); voWheelchairAssessment.setChairType(form.cmbChairType().getValue()); WheelchairSurfaceDistanceVoCollection collSurfaceDistance = new WheelchairSurfaceDistanceVoCollection(); GenForm.grdSurfaceRow rowSurface = null; for (int i = 0; i< form.grdSurface().getRows().size(); i++) { rowSurface = form.grdSurface().getRows().get(i); WheelchairSurfaceDistanceVo voSurfaceDistance = new WheelchairSurfaceDistanceVo(); voSurfaceDistance.setSurface(rowSurface.getColSurface()); voSurfaceDistance.setDistance(rowSurface.getColDistance()); collSurfaceDistance.add(voSurfaceDistance); } voWheelchairAssessment.setSurfaceDistance(collSurfaceDistance); PowerchairSkillsAssessmentVoCollection collPowerchairSkillsAssess = new PowerchairSkillsAssessmentVoCollection(); GenForm.grdPowechairRow rowPowerchair = null; for (int i = 0; i< form.grdPowechair().getRows().size(); i++) { rowPowerchair = form.grdPowechair().getRows().get(i); PowerchairSkillsAssessmentVo voPowerchairSkills = new PowerchairSkillsAssessmentVo(); voPowerchairSkills.setPowerchairSkill(rowPowerchair.getColPowerchairskills()); if(rowPowerchair.getColIndependent()) voPowerchairSkills.setPowerchairSkillAssLevel(PowerchairSkillAssessedLevel.INDEPENDENT); else if(rowPowerchair.getColSupervision()) voPowerchairSkills.setPowerchairSkillAssLevel(PowerchairSkillAssessedLevel.SUPERVISION); else if(rowPowerchair.getColUnsafe()) voPowerchairSkills.setPowerchairSkillAssLevel(PowerchairSkillAssessedLevel.SAFE); collPowerchairSkillsAssess.add(voPowerchairSkills); } voWheelchairAssessment.setPowerchairSkillsAssess(collPowerchairSkillsAssess); WheelchairSkillsAssessmentVoCollection collWheelchairSkills = new WheelchairSkillsAssessmentVoCollection(); GenForm.grdSkillsRow rowSkills = null; for (int i = 0; i< form.grdSkills().getRows().size(); i++) { rowSkills = form.grdSkills().getRows().get(i); WheelchairSkillsAssessmentVo voWheelchairSkills = new WheelchairSkillsAssessmentVo(); voWheelchairSkills.setWheelchairSkill(rowSkills.getColWheelchairSkills()); if(rowSkills.getColContgood()) voWheelchairSkills.setWheelchairSkillAssLevel(WheelchairSkillAssessedLevel.CONTINUOUSLYGOOD); else if(rowSkills.getColPoor()) voWheelchairSkills.setWheelchairSkillAssLevel(WheelchairSkillAssessedLevel.POOR); else if(rowSkills.getColFair()) voWheelchairSkills.setWheelchairSkillAssLevel(WheelchairSkillAssessedLevel.FAIR); collWheelchairSkills.add(voWheelchairSkills); } voWheelchairAssessment.setWheelchairSkillsAssess(collWheelchairSkills); return voWheelchairAssessment; }
private void displayContactAssessment(WheelchairAssessmentVo voWheelchairAssessment, ClinicalContactShortVo voClinicalContactShort) { Integer currentContactId = form.getLocalContext().getCurrentClinicalContactId(); clearFields(); if(voWheelchairAssessment!=null){ populateScreenFromData(voWheelchairAssessment); if(voClinicalContactShort.getID_ClinicalContact().equals(currentContactId)) form.btnUpdate().setVisible(true); else form.btnUpdate().setVisible(false); form.btnNew().setVisible(false); } else{ form.getLocalContext().setWheelchairAssessmentVo(null); if(voClinicalContactShort.getID_ClinicalContact().equals(currentContactId)) form.btnNew().setVisible(true); else form.btnNew().setVisible(false); form.btnUpdate().setVisible(false); } }