@Override public void setId(RecordId recordId) { record.setId(recordId); }
@Override public RecordBuilder id(RecordId id) { record.setId(id); return this; }
@Override public RecordBuilder id(String userId, Map<String, String> variantProperties) { record.setId(idGenerator.newRecordId(userId, variantProperties)); return this; }
@Override public RecordBuilder assignNewUuid() { record.setId(idGenerator.newRecordId()); return this; }
@Override public RecordBuilder id(String userId) { record.setId(idGenerator.newRecordId(userId)); return this; }
@Override public RecordBuilder assignNewUuid(Map<String, String> variantProperties) { record.setId(idGenerator.newRecordId(variantProperties)); return this; }
@Override public RecordBuilder id(RecordId id, Map<String, String> variantProperties) { record.setId(idGenerator.newRecordId(id.getMaster(), variantProperties)); return this; }
@Override public Record create(Record record) throws RepositoryException, InterruptedException { if (record.getId() == null) { record.setId(repository.getIdGenerator().newRecordId()); } if (records.containsKey(record.getId())) { throw new RecordExistsException(record.getId()); } record.setVersion(0l); record = writeRecord(record); return record; }
record.setId(repository.getIdGenerator().fromString(id));
/** * Build the {@code Put} that represents a record for inserting into HBase. * * @param record The record to be translated into an HBase {@code Put} * @return Put which can be directly written to HBase */ public Put buildPut(Record record) throws InterruptedException, RepositoryException { RecordEvent recordEvent = new RecordEvent(); recordEvent.setType(Type.CREATE); recordEvent.setTableName(hbaseRepo.getTableName()); // set empty IndexRecordFilterData to omit the warnings in the IndexEditFilter recordEvent.setIndexRecordFilterData(new RecordEvent.IndexRecordFilterData()); if (record.getId() == null) { record.setId(getIdGenerator().newRecordId()); } Put put = hbaseRepo.buildPut(record, 1L, fieldTypes, recordEvent, Sets.<BlobReference>newHashSet(), Sets.<BlobReference>newHashSet(), 1L); put.add(LilyHBaseSchema.RecordCf.DATA.bytes, LilyHBaseSchema.RecordColumn.PAYLOAD.bytes, recordEvent.toJsonBytes()); return put; }
newRecord.setId(recordId);
record.setId(repository.getIdGenerator().newRecordId());
record.setId(repository.getIdGenerator().fromBytes(idBytes));