@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()); }
@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); }