public WheelchairSkillsVo saveWheelchairSkills(WheelchairSkillsVo wheelchairSkills) throws StaleObjectException, UniqueKeyViolationException { if (wheelchairSkills == null) throw new CodingRuntimeException("This WheelchairSkillsVo is null"); if (!wheelchairSkills.isValidated()) throw new DomainRuntimeException("This WheelchairSkillsVo has not been validated"); DomainFactory factory = getDomainFactory(); if (wheelchairSkills.getID_WheelchairSkills() == null)//Inserting a record { WheelchairSkillsVo voWS = getWheelchairSkillsByClinicalContact(wheelchairSkills.getClinicalContact()); if(voWS != null) throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed"); } WheelchairSkills domWheelchairSkills = WheelchairSkillsVoAssembler.extractWheelchairSkills(factory, wheelchairSkills); factory.save(domWheelchairSkills); return WheelchairSkillsVoAssembler.create(domWheelchairSkills); }
private boolean mandatoryItemToSelect(WheelchairSkillsVo voWheelchairSkills) { boolean bMandItemRequired = false; if (voWheelchairSkills.getWheelchairSkillsIsNotNull()) { if (voWheelchairSkills.getWheelchairSkills().size() == 0) bMandItemRequired = true; } else if (voWheelchairSkills.getDetails() == null) bMandItemRequired = true; else bMandItemRequired = false; return bMandItemRequired; }
private WheelchairSkillsVo populateDataFromScreem(WheelchairSkillsVo voWheelchairSkills) { if(voWheelchairSkills.getClinicalContact()==null) voWheelchairSkills.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voWheelchairSkills.setAuthoringCP(form.qmbHCP().getValue()); DateTime dateTime = form.dtimRecording().getValue(); if(dateTime!=null) { if(form.dtimRecording().getValue().getDate()==null) { engine.showMessage("Please enter Date."); return null; } if(form.dtimRecording().getValue().getTime()==null) { engine.showMessage("Please enter Time."); return null; } } voWheelchairSkills.setAuthoringDateTime(form.dtimRecording().getValue()); WheelchairSkillCollection collWheelchairSkill = new WheelchairSkillCollection(); GenForm.grdSkillsRow rowSkills = null; for (int i = 0; i< form.grdSkills().getRows().size(); i++) { rowSkills = form.grdSkills().getRows().get(i); if(rowSkills.getColSelected()){ WheelchairSkill lkupWheelchairSkill = rowSkills.getValue(); collWheelchairSkill.add(lkupWheelchairSkill); } } if(collWheelchairSkill.size()==0) collWheelchairSkill=null; voWheelchairSkills.setWheelchairSkills(collWheelchairSkill); voWheelchairSkills.setDetails(form.txtComments().getValue()); return voWheelchairSkills; }
public WheelchairSkillsVo getWheelchairSkillsByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from WheelchairSkills w "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voClinicalContactRef != null) { hql.append(andStr + " w.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(voClinicalContactRef.getID_ClinicalContact()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); query += " order by w.id desc"; //wdev-13637 List skills = factory.find(query, markers, values); WheelchairSkillsVoCollection collWheelchairSkillsVo = WheelchairSkillsVoAssembler.createWheelchairSkillsVoCollectionFromWheelchairSkills(skills); if(collWheelchairSkillsVo!=null && collWheelchairSkillsVo.size()>0) return collWheelchairSkillsVo.get(0); return null; }
private void populateScreenFromData(WheelchairSkillsVo voWheelchairSkills) { form.getLocalContext().setWheelchairSkillsVo(voWheelchairSkills); if(voWheelchairSkills != null) { if(voWheelchairSkills.getAuthoringCPIsNotNull()) { form.qmbHCP().newRow(voWheelchairSkills.getAuthoringCP(), voWheelchairSkills.getAuthoringCP().toString()); form.qmbHCP().setValue(voWheelchairSkills.getAuthoringCP()); } form.dtimRecording().setValue(voWheelchairSkills.getAuthoringDateTime()); boolean lkupFound; GenForm.grdSkillsRow rowSkills; if(voWheelchairSkills.getWheelchairSkillsIsNotNull()) for (int i = 0; i< voWheelchairSkills.getWheelchairSkills().size(); i++) { WheelchairSkill lkupWheelchairSkill = voWheelchairSkills.getWheelchairSkills().get(i); lkupFound = false; for(int j=0; j<form.grdSkills().getRows().size(); j++){ rowSkills = form.grdSkills().getRows().get(j); if(rowSkills.getValue().equals(lkupWheelchairSkill)){ rowSkills.setColSelected(true); lkupFound = true; } } if(!lkupFound){ rowSkills = form.grdSkills().getRows().newRow(); rowSkills.setColWheelchairSkills(lkupWheelchairSkill.getText()); rowSkills.setValue(lkupWheelchairSkill); rowSkills.setColSelected(true); } } form.txtComments().setValue(voWheelchairSkills.getDetails()); } }