private static void setDetails(DocumentModel docModel, DocumentLine line) { DocumentDaoImpl dao = DB.getDocumentDao(); DetailModel detail = new DetailModel(); if (line.getId() != null) { detail = dao.getDetailById(line.getId()); } detail.setName(line.getName()); detail.getValues().clear(); Map<String, Value> vals = line.getValues(); Collection<Value> values = vals.values(); for (Value val : values) { ADValue previousValue = new ADValue(); if (val.getId() != null) { previousValue = DB.getFormDao().getValue(val.getId()); } ADValue adValue = getValue(previousValue, val); assert adValue != null; detail.addValue(adValue); } docModel.addDetail(detail); }
public static void delete(DocumentLine line) { DocumentDaoImpl dao = DB.getDocumentDao(); DetailModel model = dao.getDetailById(line.getId()); dao.delete(model); }