diff --git a/src/main/java/fr/igred/omero/AnnotatableWrapper.java b/src/main/java/fr/igred/omero/AnnotatableWrapper.java
index 18287bab..c9413b36 100644
--- a/src/main/java/fr/igred/omero/AnnotatableWrapper.java
+++ b/src/main/java/fr/igred/omero/AnnotatableWrapper.java
@@ -117,7 +117,7 @@ public > boolean isLinked(Browser browser, A anno
protected void link(Client client, A annotation)
throws ServiceException, AccessException, ExecutionException {
String error = String.format("Cannot add %s to %s", annotation, this);
- call(client.getDm(),
+ call(client.getDMFacility(),
d -> d.attachAnnotation(client.getCtx(), annotation, data),
error);
}
@@ -636,12 +636,11 @@ public List getTables(Client client)
*/
public long addFile(Client client, File file)
throws ExecutionException, InterruptedException {
- return client.getDm().attachFile(client.getCtx(),
- file,
- null,
- "",
- file.getName(),
- data).get().getId();
+ String name = file.getName();
+ return client.getDMFacility()
+ .attachFile(client.getCtx(), file, null, "", name, data)
+ .get()
+ .getId();
}
@@ -663,12 +662,14 @@ public long addAndReplaceFile(Client client, File file, ReplacePolicy policy)
throws ExecutionException, InterruptedException, AccessException, ServiceException {
List files = getFileAnnotations(client);
- FileAnnotationData uploaded = client.getDm().attachFile(client.getCtx(),
- file,
- null,
- "",
- file.getName(),
- data).get();
+ FileAnnotationData uploaded = client.getDMFacility()
+ .attachFile(client.getCtx(),
+ file,
+ null,
+ "",
+ file.getName(),
+ data)
+ .get();
FileAnnotationWrapper annotation = new FileAnnotationWrapper(uploaded);
files.removeIf(fileAnnotation -> !fileAnnotation.getFileName().equals(annotation.getFileName()));
diff --git a/src/main/java/fr/igred/omero/ObjectWrapper.java b/src/main/java/fr/igred/omero/ObjectWrapper.java
index 10333f38..0d2265ee 100644
--- a/src/main/java/fr/igred/omero/ObjectWrapper.java
+++ b/src/main/java/fr/igred/omero/ObjectWrapper.java
@@ -215,7 +215,7 @@ public String toString() {
@SuppressWarnings("unchecked")
public void saveAndUpdate(Client client)
throws ExecutionException, ServiceException, AccessException {
- data = (T) call(client.getDm(),
+ data = (T) call(client.getDMFacility(),
d -> d.saveAndReturnObject(client.getCtx(), data),
"Cannot save and update object.");
}
diff --git a/src/main/java/fr/igred/omero/client/Client.java b/src/main/java/fr/igred/omero/client/Client.java
index 4b31d051..d2bf6c34 100644
--- a/src/main/java/fr/igred/omero/client/Client.java
+++ b/src/main/java/fr/igred/omero/client/Client.java
@@ -251,7 +251,7 @@ default MetadataFacility getMetadataFacility() throws ExecutionException {
*
* @throws ExecutionException If the DataManagerFacility can't be retrieved or instantiated.
*/
- default DataManagerFacility getDm() throws ExecutionException {
+ default DataManagerFacility getDMFacility() throws ExecutionException {
return getGateway().getFacility(DataManagerFacility.class);
}
@@ -531,7 +531,7 @@ default void closeImport() {
*/
default IObject save(IObject object)
throws ServiceException, AccessException, ExecutionException {
- return call(getDm(),
+ return call(getDMFacility(),
d -> d.saveAndReturnObject(getCtx(), object),
"Cannot save object");
}
@@ -550,7 +550,7 @@ default IObject save(IObject object)
default void delete(IObject object)
throws ServiceException, AccessException, ExecutionException, InterruptedException {
final long wait = 500L;
- ExceptionHandler.ofConsumer(getDm(),
+ ExceptionHandler.ofConsumer(getDMFacility(),
d -> d.delete(getCtx(), object).loop(10, wait))
.rethrow(InterruptedException.class)
.handleOMEROException("Cannot delete object")
@@ -571,7 +571,7 @@ default void delete(IObject object)
default void delete(List objects)
throws ServiceException, AccessException, ExecutionException, InterruptedException {
final long wait = 500L;
- ExceptionHandler.ofConsumer(getDm(),
+ ExceptionHandler.ofConsumer(getDMFacility(),
d -> d.delete(getCtx(), objects).loop(10, wait))
.rethrow(InterruptedException.class)
.handleOMEROException("Cannot delete objects")
diff --git a/src/main/java/fr/igred/omero/containers/FolderWrapper.java b/src/main/java/fr/igred/omero/containers/FolderWrapper.java
index 3c60bdc4..9e5f2196 100644
--- a/src/main/java/fr/igred/omero/containers/FolderWrapper.java
+++ b/src/main/java/fr/igred/omero/containers/FolderWrapper.java
@@ -261,7 +261,7 @@ public void addImages(Client client, ImageWrapper... images)
links.add(link);
}
}
- ExceptionHandler.of(client.getDm(),
+ ExceptionHandler.of(client.getDMFacility(),
d -> d.saveAndReturnObject(client.getCtx(), links, null, null))
.handleOMEROException("Cannot save links.")
.rethrow();