Esempio n. 1
0
 public void setSelectedUserRoles(DualListModel<RoleData> rolesModel) {
   getUserForm().setSelectedUserRolesModel(rolesModel);
   List<String> ids = new ArrayList<String>();
   for (RoleData data : getUserForm().getSelectedUserRolesModel().getTarget())
     ids.add(data.getRole());
   if (ids.size() > 0) getUserForm().getSelectedUser().setRoleIds(ids);
 }
Esempio n. 2
0
 public DualListModel<RoleData> getSelectedUserRoles() {
   if (getUserForm().getSelectedUserRolesModel() == null) {
     List<RoleData> source = new ArrayList<RoleData>();
     List<RoleData> target = new ArrayList<RoleData>();
     for (RoleData role : roleProcessor.getRoles()) {
       boolean setToSource = true;
       if (getUserForm().getSelectedUser() != null) {
         for (String roleId : getUserForm().getSelectedUser().getRoleIds()) {
           if (role.getRole().equals(roleId)) {
             target.add(role);
             setToSource = false;
           }
         }
       }
       if (setToSource) source.add(role);
     }
     getUserForm().setSelectedUserRolesModel(new DualListModel<RoleData>(source, target));
   }
   return getUserForm().getSelectedUserRolesModel();
 }
Esempio n. 3
0
 public void setRolesModel(DualListModel<RoleData> rolesModel) {
   this.rolesModel = rolesModel;
   List<String> ids = new ArrayList<String>();
   for (RoleData data : rolesModel.getTarget()) ids.add(data.getRole());
   if (ids.size() > 0) getUserForm().getUser().setRoleIds(ids);
 }