Skip to content

Commit

Permalink
Rename getDm() to getDMFacility()
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Nov 29, 2024
1 parent bdd6218 commit b8e36f9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
27 changes: 14 additions & 13 deletions src/main/java/fr/igred/omero/AnnotatableWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public <A extends AnnotationWrapper<?>> boolean isLinked(Browser browser, A anno
protected <A extends AnnotationData> 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);
}
Expand Down Expand Up @@ -636,12 +636,11 @@ public List<TableWrapper> 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();
}


Expand All @@ -663,12 +662,14 @@ public long addAndReplaceFile(Client client, File file, ReplacePolicy policy)
throws ExecutionException, InterruptedException, AccessException, ServiceException {
List<FileAnnotationWrapper> 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()));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/igred/omero/ObjectWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/fr/igred/omero/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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");
}
Expand All @@ -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")
Expand All @@ -571,7 +571,7 @@ default void delete(IObject object)
default void delete(List<IObject> 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")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/igred/omero/containers/FolderWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b8e36f9

Please sign in to comment.