public HandTestVo saveHandTest(HandTestVo handTest) throws StaleObjectException, UniqueKeyViolationException { if (!handTest.isValidated()) throw new DomainRuntimeException("This Hand Test has not been validated"); DomainFactory factory = getDomainFactory(); if(handTest.getID_HandTest() == null) { if(handTest.getClinicalContactIsNotNull()) { HandTestVoCollection coll = getHandTest(handTest.getClinicalContact().getID_ClinicalContact()); if(coll != null && coll.size()>0) throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed."); } } HandTest doHandTest = HandTestVoAssembler.extractHandTest(factory, handTest); factory.save(doHandTest); return HandTestVoAssembler.create(doHandTest); }
private void displayContactAssessment(HandTestVo voHandTest, ClinicalContactShortVo voClinicalContactShort) { Integer currentContactId = form.getLocalContext().getCurrentClinicalContactId(); clearFields(); if(voHandTest!=null){ populateScreenFromData(voHandTest); if(voClinicalContactShort.getID_ClinicalContact().equals(currentContactId)) form.btnUpdate().setVisible(true); else form.btnUpdate().setVisible(false); form.btnNew().setVisible(false); } else{ form.getLocalContext().setHandVo(null); if(voClinicalContactShort.getID_ClinicalContact().equals(currentContactId)) form.btnNew().setVisible(true); else form.btnNew().setVisible(false); form.btnUpdate().setVisible(false); } }
private void populateScreenFromData(HandTestVo voHandTest) { form.getLocalContext().setHandVo(voHandTest); if(voHandTest.getAuthoringCPIsNotNull()){ form.qmbAuthoringHCP().newRow(voHandTest.getAuthoringCP(), voHandTest.getAuthoringCP().getName().toString()); form.qmbAuthoringHCP().setValue(voHandTest.getAuthoringCP()); } if(voHandTest.getAuthoringDateTimeIsNotNull()) form.dtimAuthoring().setValue(voHandTest.getAuthoringDateTime()); if(voHandTest.getDominantHandIsNotNull()) form.cmbDominantHand().setValue(voHandTest.getDominantHand()); if(voHandTest.getLeftPinchStrengthIsNotNull()) form.intLeftPinch().setValue(voHandTest.getLeftPinchStrength()); if(voHandTest.getLeftThumbIndexSpanExtensionIsNotNull()) form.decLeftThumb().setValue(voHandTest.getLeftThumbIndexSpanExtension()); if(voHandTest.getRightPinchStrengthIsNotNull()) form.intRightPinch().setValue(voHandTest.getRightPinchStrength()); if(voHandTest.getRightThumbIndexSpanExtensionIsNotNull()) form.decRightThumb().setValue(voHandTest.getRightThumbIndexSpanExtension()); if(voHandTest.getLeftBulbDynamometerIsNotNull()) form.intLeftBulb().setValue(voHandTest.getLeftBulbDynamometer()); if(voHandTest.getRightBulbDynamometerIsNotNull()) form.intRightBulb().setValue(voHandTest.getRightBulbDynamometer()); GenForm.grdGripRow rowGrip; if(voHandTest.getGripStrengthIsNotNull()) for (int i = 0; i< voHandTest.getGripStrength().size(); i++) { HandJaymarVo voHandJaymar = voHandTest.getGripStrength().get(i); rowGrip = form.grdGrip().getRows().newRow(); rowGrip.setcolTree(voHandJaymar.getJaymarLevel()); if(voHandJaymar.getJaymarFindingIsNotNull()){ for (int j = 0; j< voHandJaymar.getJaymarFinding().size(); j++) { HandJaymarFindingsVo voHandJaymarFinding = voHandJaymar.getJaymarFinding().get(j); if(voHandJaymarFinding.getLaterality().equals(LateralityLRonly.RIGHT)){ if(voHandJaymarFinding.getTest1IsNotNull()) rowGrip.setColTest1Right(voHandJaymarFinding.getTest1()); else rowGrip.setColTest1Right(new Float(0)); if(voHandJaymarFinding.getTest2IsNotNull()) rowGrip.setColTest2Right(voHandJaymarFinding.getTest2()); else rowGrip.setColTest2Right(new Float(0)); if(voHandJaymarFinding.getTest3IsNotNull()) rowGrip.setColTest3Right(voHandJaymarFinding.getTest3()); else rowGrip.setColTest3Right(new Float(0)); rowGrip.setColAvgRight(voHandJaymarFinding.getLevelAverage()); } else if(voHandJaymarFinding.getLaterality().equals(LateralityLRonly.LEFT)){ if(voHandJaymarFinding.getTest1IsNotNull()) rowGrip.setColTest1Left(voHandJaymarFinding.getTest1()); else rowGrip.setColTest1Left(new Float(0)); if(voHandJaymarFinding.getTest2IsNotNull()) rowGrip.setColTest2Left(voHandJaymarFinding.getTest2()); else rowGrip.setColTest2Left(new Float(0)); if(voHandJaymarFinding.getTest3IsNotNull()) rowGrip.setColTest3Left(voHandJaymarFinding.getTest3()); else rowGrip.setColTest3Left(new Float(0)); rowGrip.setColAvgLeft(voHandJaymarFinding.getLevelAverage()); } } } } }
private HandTestVo populateDataFromScreem(HandTestVo voHandTest) { if(voHandTest.getClinicalContact()==null) voHandTest.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); if(voHandTest.getCareContext()==null) voHandTest.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); voHandTest.setAuthoringCP(form.qmbAuthoringHCP().getValue()); if(form.dtimAuthoring().getValue()==null || form.dtimAuthoring().getValue().getDate()==null){ engine.showErrors(new String[]{"Authoring Date/Time is mandatory."}); //wdev-13070 return null; } if(form.dtimAuthoring().getValue()==null || form.dtimAuthoring().getValue().getTime()==null){ engine.showErrors(new String[]{"Authoring Date/Time is mandatory."}); //wdev-13070 return null; } voHandTest.setAuthoringDateTime(form.dtimAuthoring().getValue()); voHandTest.setDominantHand(form.cmbDominantHand().getValue()); voHandTest.setLeftPinchStrength(form.intLeftPinch().getValue()); voHandTest.setLeftThumbIndexSpanExtension(form.decLeftThumb().getValue()); voHandTest.setRightPinchStrength(form.intRightPinch().getValue()); voHandTest.setRightThumbIndexSpanExtension(form.decRightThumb().getValue()); voHandTest.setLeftBulbDynamometer(form.intLeftBulb().getValue()); voHandTest.setRightBulbDynamometer(form.intRightBulb().getValue()); GenForm.grdGripRow rowGrip; HandJaymarVoCollection collHandJaymar = new HandJaymarVoCollection(); for(int i=0; i<form.grdGrip().getRows().size(); i++){ rowGrip = form.grdGrip().getRows().get(i); HandJaymarFindingsVoCollection collHandJaymarFindings = new HandJaymarFindingsVoCollection(); HandJaymarFindingsVo voHandJaymarRight = new HandJaymarFindingsVo(); HandJaymarVo voHandJaymar = new HandJaymarVo(); voHandJaymar.setJaymarLevel(rowGrip.getcolTree()); voHandJaymarRight.setLaterality(LateralityLRonly.RIGHT); voHandJaymarRight.setTest1(rowGrip.getColTest1Right()); voHandJaymarRight.setTest2(rowGrip.getColTest2Right()); voHandJaymarRight.setTest3(rowGrip.getColTest3Right()); voHandJaymarRight.setLevelAverage(getAverage(rowGrip.getColTest1Right(), rowGrip.getColTest2Right(), rowGrip.getColTest3Right())); collHandJaymarFindings.add(voHandJaymarRight); HandJaymarFindingsVo voHandJaymarLeft = new HandJaymarFindingsVo(); voHandJaymarLeft.setLaterality(LateralityLRonly.LEFT); voHandJaymarLeft.setTest1(rowGrip.getColTest1Left()); voHandJaymarLeft.setTest2(rowGrip.getColTest2Left()); voHandJaymarLeft.setTest3(rowGrip.getColTest3Left()); voHandJaymarLeft.setLevelAverage(getAverage(rowGrip.getColTest1Left(), rowGrip.getColTest2Left(), rowGrip.getColTest3Left())); collHandJaymarFindings.add(voHandJaymarLeft); voHandJaymar.setJaymarFinding(collHandJaymarFindings); collHandJaymar.add(voHandJaymar); } voHandTest.setGripStrength(collHandJaymar); return voHandTest; }