@Override public DocumentRoute importRouteModel(URL modelToImport, boolean overwrite, CoreSession session) { if (modelToImport == null) { throw new NuxeoException(("No resource containing route templates found")); } Blob blob = new URLBlob(modelToImport); final String file = modelToImport.getFile(); DocumentModel doc; try { FileImporterContext context = FileImporterContext.builder(session, blob, persister.getParentFolderForDocumentRouteModels(session).getPathAsString()) .overwrite(true) .fileName(file) .build(); doc = getFileManager().createOrUpdateDocument(context); } catch (IOException e) { throw new NuxeoException(e); } if (doc == null) { throw new NuxeoException("Can not import document " + file); } // remove model from cache if any model with the same id existed if (modelsChache != null) { modelsChache.invalidate(doc.getName()); } return doc.getAdapter(DocumentRoute.class); }