private void search() throws ims.framework.exceptions.PresentationLogicException { if(form.cmbRole().getValue() == null) { engine.showErrors(new String[] {"Role is mandatory in Search Criteria"}); return; } form.getLocalContext().setRecordsExist(false); //do a get from the configuration for this role and see if a record exists RoleDisciplineSecurityLevelVoCollection voCollRoleDispSecurity = domain.listRoleDisciplineSecurityLevelByRole(form.cmbRole().getValue()); if(voCollRoleDispSecurity != null && voCollRoleDispSecurity.size() > 0) { //record(s) found populatescreen open(); populateScreenFromData(voCollRoleDispSecurity); } else { engine.showMessage("No matching records found"); open(); } updateControlState(); }
private String[] getUIValidationErrors(RoleDisciplineSecurityLevelVoCollection voCollRoleSecurityLevel) { List<String> errors = new ArrayList<String>(); if(form.cmbRoleDetail().getValue() == null) errors.add("'Role' is mandatory"); if(voCollRoleSecurityLevel == null || voCollRoleSecurityLevel.size() == 0) errors.add("Nothing selected to save"); for(RoleDisciplineSecurityLevelVo voRoleDisSec : voCollRoleSecurityLevel) { if(voRoleDisSec.getOrderingSecurityLevel() == null && voRoleDisSec.getViewingSecurityLevel() == null) errors.add("No 'Ordering Security Level' or 'Viewing Security Level' selected"); } return errors.size() > 0 ? errors.toArray(new String[0]) : null; }
private void populateScreenFromData(RoleDisciplineSecurityLevelVoCollection voCollRoleDispSecurity) { if(voCollRoleDispSecurity == null) throw new CodingRuntimeException("voCollRoleDispSecurity is null in method populateScreenFromData"); form.cmbRoleDetail().newRow(form.cmbRole().getValue(), form.cmbRole().getValue().getName()); form.cmbRoleDetail().setValue(form.cmbRole().getValue()); for(RoleDisciplineSecurityLevelVo voRoleDispSec : voCollRoleDispSecurity) { ServiceRefVo voService = voRoleDispSec.getService(); for(int i=0;i<form.grdDiscipline().getRows().size(); i++) { grdDisciplineRow row = form.grdDiscipline().getRows().get(i); if(row.getRows() != null && row.getRows().size() > 0) { for(int p=0;p<row.getRows().size();p++) { grdDisciplineRow cRow = row.getRows().get(p); if(cRow.getColServiceValue().equals(voService)) { cRow.getColOrderingSecurityLevel().setValue(voRoleDispSec.getOrderingSecurityLevel()); cRow.getColViewingSecurityLevel().setValue(voRoleDispSec.getViewingSecurityLevel()); cRow.setValue(voRoleDispSec); } } } } } if(voCollRoleDispSecurity.size() > 0) form.getLocalContext().setRecordsExist(true); }
public void saveRoleDisciplineSecurity(RoleDisciplineSecurityLevelVoCollection voCollRoleDisciplineSecurity) throws StaleObjectException { DomainFactory factory = getDomainFactory(); List doLstRoleDispSec = RoleDisciplineSecurityLevelVoAssembler.extractRoleDisciplineSecurityLevelList(factory, voCollRoleDisciplineSecurity); Iterator it = doLstRoleDispSec.iterator(); while(it.hasNext()) { RoleDisciplineSecurityLevel doRoleDispSec = (RoleDisciplineSecurityLevel)it.next(); factory.save(doRoleDispSec); } }
@Override protected void onBtnSaveClick() throws PresentationLogicException { RoleDisciplineSecurityLevelVoCollection voCollRoleSecurityLevel = populateDataFromScreen(); String[] uiErrors = getUIValidationErrors(voCollRoleSecurityLevel); if(uiErrors != null) { engine.showErrors(uiErrors); return; } String[] arrErrors = voCollRoleSecurityLevel.validate(); if(arrErrors != null) { engine.showErrors(arrErrors); return; } try { domain.saveRoleDisciplineSecurity(voCollRoleSecurityLevel); //WDEV-9780 to force call to db on instantiation forms for this persistent Global Context form.getGlobalContext().OCRR.clearRoleDisciplineSecurityLevels(); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); search(); } //for redisplay if(voCollRoleSecurityLevel != null && voCollRoleSecurityLevel.size() > 0) setLastSavedRoleIntoSearchCriteria(voCollRoleSecurityLevel.get(0).getRole()); form.setMode(FormMode.VIEW); open(); search(); }
public RoleDisciplineSecurityLevelVoCollection listRoleDisciplineSecurityLevelByRole(AppRoleRefVo voRole) { String hql = "from RoleDisciplineSecurityLevel rds where rds.role.id = " + voRole.getID_AppRole(); List lstRdss = getDomainFactory().find(hql); return RoleDisciplineSecurityLevelVoAssembler.createRoleDisciplineSecurityLevelVoCollectionFromRoleDisciplineSecurityLevel(lstRdss); }