/** * Creates a linked Payload in the specified DigitalObject * * @param object the DigitalObject to create the Payload in * @param pid the Payload ID * @param path the absolute path to the file the Payload links to * @return a Payload * @throws StorageException if the Payload could not be created */ public static Payload createLinkedPayload(DigitalObject object, String pid, String path) throws StorageException { Payload payload = null; try { payload = object.createLinkedPayload(pid, path); } catch (StorageException ex) { throw ex; } return payload; } }
public static Payload createOrUpdatePayload(DigitalObject object, String pid, InputStream in, String filePath) throws StorageException { Payload payload = null; try { if (filePath == null) { payload = object.createStoredPayload(pid, in); } else { payload = object.createLinkedPayload(pid, filePath); } } catch (StorageException ex) { try { payload = object.updatePayload(pid, in); } catch (StorageException ex1) { throw ex1; } } return payload; }