| Back | Main view

How to delete object using IMiS/Storage Connector JAVA

Product:IMiS/Storage Connector JAVA
Release:10.3.2210, 10.2.2110, 10.1.2010
Date:02/17/2023

Case: How to delete object using IMiS/Storage Connector JAVA

Description:

This example demonstrates operations which deletes object on Storage on the IMiS/ARChive Server.

Below is a description of operation for deleting objects using internal and external identifier.


1. Delete object with internal identifier

Operation deletes object with internal identifier on IMiS/ARC archive.

JAVA

Storage storage = IMIS_STORAGE;
String auditLogMessage= "Reason for deletion";
String id = "<object identifier>";

try {
  // Set audit log message
  if (null != auditLogMessage)
    storage.getAuditLog().setMessage(auditLogMessage);
  // Delete object
  storage.deleteObject(id);
  System.out.println("Object with id:'" + id + "' deleted");
}
catch (Exception e) {
  e.printStackTrace();
  System.out.println(e.getMessage());
}

2. Delete object with external identifier

Operation deletes object with external identifier on IMiS/ARC archive.

JAVA

Storage storage = IMIS_STORAGE;
String auditLogMessage= "Reason for deletion";
String id = "<object external identifier>";

try {
  // Set audit log message
  if (null != auditLogMessage)
    mStorage.getAuditLog().setMessage(auditLogMessage);
  // Set object id kind
  Map options = new HashMap<String, Object>();
  options.put(StorageConnector.OPTION_OBJECT_IDKIND, ObjectIdKind.EXTERNAL);
  // Delete object
  mStorage.deleteObject(id, options);
  System.out.println("Object with external id:'" + id + "' deleted");
}
catch (Exception e) {
  e.printStackTrace();
  System.out.println(e.getMessage());
}



Related Documents:



| Back | Main view