protected String getModelLabel(RootEntity o) { if (o == null) return ""; String label = Strings.cut(o.getName(), 75); Location location = null; if (o instanceof Flow) location = ((Flow) o).getLocation(); else if (o instanceof Process) location = ((Process) o).getLocation(); if (location != null && location.getCode() != null) label += " (" + location.getCode() + ")"; return label; }
private void writeExternalFiles(RootEntity entity, ModelType type, Callback cb) { if (entity == null || conf.db == null || conf.db.getFileStorageLocation() == null || conf.store == null) return; FileStore fs = new FileStore(conf.db.getFileStorageLocation()); File dir = fs.getFolder(entity); if (dir == null || !dir.exists()) return; try { Path dbDir = dir.toPath(); Copy copy = new Copy(entity.getRefId(), type, dbDir); Files.walkFileTree(dir.toPath(), copy); } catch (Exception e) { cb.apply(Message.error("failed to copy external files", e), entity); } }