public void removeFromBatch(Database db, Integer batchId, List<Integer> entityIds) throws DatabaseException, IOException { for (Integer id : entityIds) { MolgenisBatchEntity entity = new MolgenisBatchEntity(); entity.setId(id); entity.setBatch(batchId); db.remove(entity); } }
public void addToBatch(Database db, Integer batchId, List<Integer> targetIds) throws DatabaseException, ParseException, IOException { for (Integer targetId : targetIds) { ObservationTarget target = db.findById(ObservationTarget.class, targetId); // TODO: Danny use or loose /*List<OntologyTerm> terms = db.query(OntologyTerm.class).equals(OntologyTerm.NAME, target.getClass().toString()).find();*/ // if (terms.size() != 1) // throw new DatabaseException("No OntologyTerm found for " + // target.getClass().toString()); MolgenisBatchEntity entity = new MolgenisBatchEntity(); // entity.setEntityType(terms.get(0)); entity.setBatch(batchId); entity.setName(target.getName()); entity.setObjectId(target.getId()); db.add(entity); } }