private RepositoryRecord createRepositoryRecord(final Record updateRecord) throws IOException { if (updateRecord == null) { // null may be returned by reader.readRecord() if it encounters end-of-stream return null; } // Top level is always going to be a "Repository Record Update" record because we need a 'Union' type record at the // top level that indicates which type of record we have. final Record record = (Record) updateRecord.getFieldValue(RepositoryRecordSchema.REPOSITORY_RECORD_UPDATE_V2); final String actionType = (String) record.getFieldValue(RepositoryRecordSchema.ACTION_TYPE_FIELD); final RepositoryRecordType recordType = RepositoryRecordType.valueOf(actionType); switch (recordType) { case CREATE: return createRecord(record); case CONTENTMISSING: case DELETE: return deleteRecord(record); case SWAP_IN: return swapInRecord(record); case SWAP_OUT: return swapOutRecord(record); case UPDATE: return updateRecord(record); } throw new IOException("Found unrecognized Update Type '" + actionType + "'"); }
private RepositoryRecord createRepositoryRecord(final Record updateRecord) throws IOException { if (updateRecord == null) { // null may be returned by reader.readRecord() if it encounters end-of-stream return null; } // Top level is always going to be a "Repository Record Update" record because we need a 'Union' type record at the // top level that indicates which type of record we have. final Record record = (Record) updateRecord.getFieldValue(RepositoryRecordSchema.REPOSITORY_RECORD_UPDATE_V2); final String actionType = (String) record.getFieldValue(RepositoryRecordSchema.ACTION_TYPE_FIELD); final RepositoryRecordType recordType = RepositoryRecordType.valueOf(actionType); switch (recordType) { case CREATE: return createRecord(record); case CONTENTMISSING: case DELETE: return deleteRecord(record); case SWAP_IN: return swapInRecord(record); case SWAP_OUT: return swapOutRecord(record); case UPDATE: return updateRecord(record); } throw new IOException("Found unrecognized Update Type '" + actionType + "'"); }