private void refreshSelectedRole() { if (form.grdRoles().getValue() == null) return; AppRoleVo voRole = domain.getRole(form.grdRoles().getValue()); form.getLocalContext().setRoleSelected(voRole); form.txtRoleName().setValue(voRole.getName()); form.txtRoleDesc().setValue(voRole.getDescription()); form.chkIsActive().setValue(voRole.getIsActive().booleanValue()); form.ccTaxonomyMappings().setValue(voRole.getCodeMappings()); form.cmbNavs().setValue(voRole.getNavigation()); form.cmbTopButtons().setValue(voRole.getTopButtonConfig()); populateNavigation(voRole.getNavigation()); form.btnUpdate().setEnabled(true); populateAppRights(voRole.getAppRights()); populateMenuActions(voRole.getFormMenuActionsDenied()); }
public AppRoleVo getAppRoleByTaxonomyType(String extId, TaxonomyType taxonomyType) { if (extId == null || taxonomyType == null) return null; DomainFactory factory = (DomainFactory) this.getDomainFactory(); String hql = " from AppRole ar join ar.codeMappings as cm where cm.taxonomyName = :taxType and cm.taxonomyCode = :extId "; List appRole = factory.find(hql,new String[]{"taxType", "extId"}, new Object[]{getDomLookup(taxonomyType),extId}); if (appRole != null && appRole.size() == 1) return AppRoleVoAssembler.create((AppRole) appRole.get(0)); else if (appRole != null && appRole.size() > 1) throw new DomainRuntimeException("Non unique hit on AppRole by TaxonomyType " + taxonomyType.getText() + " and code " + extId); return null; }
private boolean isAlreadySelected(AppRightVo voRight) { AppRoleVo voRole = form.getLocalContext().getRoleSelected(); AppRightVoCollection collSelectedRights = voRole.getAppRights(); for (int i = 0; i < collSelectedRights.size(); i++) { AppRightVo voSelectedRight = collSelectedRights.get(i); if(voSelectedRight.getName().equals(voRight.getName())) return true; } return false; }
protected void onBtnNewClick() throws PresentationLogicException { form.getLocalContext().setRoleSelected(new AppRoleVo()); form.setMode(FormMode.EDIT); clearAllFields(); listRoles(); form.grdRoles().setEnabled(false); form.getContextMenus().getGenericGridRemoveItem().setVisible(false); populateAppRightsCombo(false); }
private String[] validateUIRules(AppNavigationVo navigation, AppRoleVo role) { List<String> uiErrors = new ArrayList<String>(); for(int i=0; i<form.lyrRights().tabAlerts().dyngrdAlerts().getRows().size(); i++) { DynamicGridRow row = form.lyrRights().tabAlerts().dyngrdAlerts().getRows().get(i); if(row.getCells().get(getColumn(COL_ALERT)).getValue() != null && row.getCells().get(getColumn(COL_ACCESS)).getValue() == null) { uiErrors.add("Alert Access Right is mandatory."); } if(row.getCells().get(getColumn(COL_ALERT)).getValue() == null && row.getCells().get(getColumn(COL_ACCESS)).getValue() != null) { uiErrors.add("Alert Category is mandatory."); } } //WDEV-22749 if (navigation != null && Boolean.FALSE.equals(navigation.getIsActive()) && Boolean.TRUE.equals(role.getIsActive())) { uiErrors.add("Selected navigation must be active."); } //WDEV-22749 ends here String[] uiResults = new String[uiErrors.size()]; uiErrors.toArray(uiResults); return uiResults; }
protected void onBtnNewClick() throws PresentationLogicException { form.getLocalContext().setRoleSelected(new AppRoleVo()); form.setMode(FormMode.EDIT); clearAllFields(); listRoles(); form.grdRoles().setEnabled(false); form.getContextMenus().getGenericGridRemoveItem().setVisible(false); updateComponentState(); //WDEV-20420 // populateAppRightsCombo(false); }
private void refreshSelectedRole() { if (form.grdRoles().getValue() == null) return; AppRoleVo voRole = domain.getRole(form.grdRoles().getValue()); form.getLocalContext().setRoleSelected(voRole); form.chkRequiresPDS().setValue(Boolean.TRUE.equals(voRole.getRequiresPDS())); //WDEV-20420 form.cmbSpineRBAC().setValue(voRole.getSpineRbac()); //WDEV-20420 updateComponentState(); //WDEV-20420 form.txtRoleName().setValue(voRole.getName()); form.txtRoleDesc().setValue(voRole.getDescription()); form.chkIsActive().setValue(voRole.getIsActive().booleanValue()); form.ccTaxonomyMappings().setValue(voRole.getCodeMappings()); form.cmbNavs().setValue(voRole.getNavigation()); form.cmbTopButtons().setValue(voRole.getTopButtonConfig()); form.intSessionTimeout().setValue(voRole.getSessionTimeoutIsNotNull() ? voRole.getSessionTimeout(): 0); form.intAutolock().setValue(voRole.getAutolockTimerIsNotNull() ? voRole.getAutolockTimer() : 0); populateNavigation(voRole.getNavigation()); form.btnUpdate().setEnabled(true); populateAppRights(voRole.getAppRights()); populateAppPdsRights(voRole.getPdsRights()); //WDEV-20617 populateMenuActions(voRole.getFormMenuActionsDenied()); populateAlertsRightFromData(voRole.getAlertsAccess()); }
public AppRoleVo saveRole(AppRoleVo voRole) throws StaleObjectException, UniqueKeyViolationException { if (!voRole.isValidated()) { throw new DomainRuntimeException("Role ValueObject has not been validated"); } DomainFactory factory = getDomainFactory(); AppRole domRole = AppRoleVoAssembler.extractAppRole(factory, voRole); try { if (voRole.getCodeMappingsIsNotNull()) { boolean found = false; StringBuilder errors = new StringBuilder(); for (int i = 0; i < voRole.getCodeMappings().size(); i++) { TaxonomyMap code = voRole.getCodeMappings().get(i); AppRole appRole = getAppRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName()); if (appRole != null && appRole.getId() != voRole.getId()) { found = true; errors.append("\nRole '" + appRole.getName() + "' aleady have mapped :"); errors.append(" TaxonomyType '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'"); } } if(found) throw new UniqueKeyViolationException(errors.toString()); } factory.save(domRole); } catch(UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("A role with this name already exists within the system, please change", e); } return AppRoleVoAssembler.create(domRole); }
public AppRoleVo getRole(AppRoleShortVo roleVo) { DomainFactory factory = getDomainFactory(); return AppRoleVoAssembler.create((AppRole)factory.getDomainObject(AppRole.class, roleVo.getID_AppRole())); }
public AppRoleVo saveRole(AppRoleVo voRole) throws StaleObjectException, UniqueKeyViolationException { if (!voRole.isValidated()) { throw new DomainRuntimeException("Role ValueObject has not been validated"); } DomainFactory factory = getDomainFactory(); AppRole domRole = AppRoleVoAssembler.extractAppRole(factory, voRole); try { if (voRole.getCodeMappingsIsNotNull()) { boolean found = false; StringBuilder errors = new StringBuilder(); for (int i = 0; i < voRole.getCodeMappings().size(); i++) { TaxonomyMap code = voRole.getCodeMappings().get(i); AppRole appRole = getAppRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName()); if (appRole != null && appRole.getId() != voRole.getId()) { found = true; errors.append("\nRole '" + appRole.getName() + "' aleady have mapped :"); errors.append(" TaxonomyType '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'"); } } if(found) throw new UniqueKeyViolationException(errors.toString()); } factory.save(domRole); } catch(UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("A role with this name already exists within the system, please change", e); } //Map role to client ID SessionData sessData = (SessionData)factory.getDomainSession().getAttribute(SessionConstants.SESSION_DATA); sessData.clientAutolockTimer.get().put(sessData.uniqueClientId.get(), voRole); return AppRoleVoAssembler.create(domRole); }