/** * This function is actually responsible for querying the database. * * @return list of entity objects currently in view * @throws DatabaseException */ private List<E> getData(Database db) throws DatabaseException { // TODO: move the row level security to the entitymapper... FormModel<E> model = getModel(); // set form level rights boolean formReadonly = model.isReadonly() || !model.getLogin().canWrite(model.create().getClass()); model.setReadonly(formReadonly); // load the rows List<E> visibleRecords = new ArrayList<E>(); // load all records and select rows that can be visible // List allRecords = view.getDatabase().find( view.getEntityClass(), // allRules ); List<E> allRecords = pager.getPage(db); for (E record : allRecords) { boolean rowReadonly = formReadonly || !model.getLogin().canWrite(record.getClass()); if (rowReadonly) record.setReadonly(true); // else // recordreadonly = false; visibleRecords.add(record); } return visibleRecords; }
public E next() { E dtoObject = transferData.get(cursor++); dtoObject.setReadonly(readonly); return dtoObject; }