Esempio n. 1
0
 @Override
 protected void bindModelToEntity() {
   Role editedRole = model.getEditedEntity();
   editedRole.setName(model.getName());
   editedRole.setDescription(model.getDescription());
   editedRole.getPermissions().clear();
   editedRole
       .getPermissions()
       .addAll(model.getPermissionSelectionListener().getSelectedElements());
 }
Esempio n. 2
0
  @Override
  protected void bindEntityToModel() {
    Role editedRole = model.getEditedEntity();
    model.setName(editedRole.getName());
    model.setDescription(editedRole.getDescription());

    DefaultSelectionDataModelListener<Permission> selectionListener =
        new DefaultSelectionDataModelListener<Permission>(
            new HashSet<Permission>(editedRole.getPermissions()));
    SelectableDataModel<Permission> permissionDataModel =
        new SelectableDataModel<Permission>(service.getAllPermissions(), selectionListener);
    model.setPermissionsDataModel(permissionDataModel);
    model.setPermissionSelectionListener(selectionListener);
  }