/** * Store the processed data and metadata in the system * * @param dataJson an instantiated JSON object containing data to store * @param metaJson an instantiated JSON object containing metadata to store * @throws HarvesterException if an error occurs */ private void storeJsonInObject(JsonObject dataJson, JsonObject metaJson, String oid) throws HarvesterException { // Does the object already exist? DigitalObject object = null; try { object = getStorage().getObject(oid); boolean isModified = isModifiedRecord(oid, dataJson); storeJsonInPayload(dataJson, metaJson, object); object.getMetadata().setProperty("isModified", Boolean.toString(isModified)); } catch (StorageException ex) { // This is going to be brand new try { object = StorageUtils.getDigitalObject(getStorage(), oid); storeJsonInPayload(dataJson, metaJson, object); // newRecordCount++; object.getMetadata().setProperty("isNew", "true"); } catch (StorageException ex2) { throw new HarvesterException("Error creating new digital object: ", ex2); } } // Set the pending flag if (object != null) { try { object.getMetadata().setProperty("render-pending", "true"); object.close(); } catch (Exception ex) { log.error("Error setting 'render-pending' flag: ", ex); } } }