@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; }
/** * Create a new UUID-based record id. * * @return UUID record id */ public RecordId newRecordId() { return bulkIngester.getIdGenerator().newRecordId(); }
@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; }
/** * Create a new user-specified record id. * * @param userProvidedId user-specified id * @return user-specified record id */ public RecordId newRecordId(String userProvidedId) { return bulkIngester.getIdGenerator().newRecordId(userProvidedId); }
/** * Called for expressions of the kind "+prop". */ public Dep plus(IdGenerator idGenerator, Map<String, String> propsToAdd) { RecordId master = id.getMaster(); Map<String, String> newVariantProperties = Maps.newHashMap(id.getVariantProperties()); Set<String> newVprops = Sets.newHashSet(this.moreDimensionedVariants); for (String key: propsToAdd.keySet()) { String value = propsToAdd.get(key); if (value == null) { newVprops.add(key); } else { newVariantProperties.put(key, value); } } return new Dep(idGenerator.newRecordId(master, newVariantProperties), newVprops); }
/** * Called for expressions of the kind "-prop". * * <p>[I guess] this is only of importance when expressions would be like "+prop=>-prop", e.g. * the same prop was first forward-dereferenced and then backward-dereferenced, otherwise * it would not be in the moreDimensionedVariants map. */ public Dep minus(IdGenerator idGenerator, Set<String> vprops) { RecordId master = id.getMaster(); Map<String, String> variantProps = Maps.newHashMap(id.getVariantProperties()); Set<String> newVprops = Sets.newHashSet(vprops); for (String prop: vprops) { variantProps.remove(prop); newVprops.remove(prop); } return new Dep(idGenerator.newRecordId(master, variantProps), newVprops); }
@Override public RecordBuilder id(RecordId id, Map<String, String> variantProperties) { record.setId(idGenerator.newRecordId(id.getMaster(), variantProperties)); return this; }
return masterRecordId; } else { return idGenerator.newRecordId(masterRecordId, varProps);
@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; }
Set<DependencyEntry> deserializeDependenciesForward(byte[] serialized) throws IOException { final DataInputImpl dataInput = new DataInputImpl(serialized); final int nDependencies = dataInput.readInt(); final Set<DependencyEntry> result = new HashSet<DependencyEntry>(nDependencies); while (result.size() < nDependencies) { final int tableLength = dataInput.readInt(); final String table = Bytes.toString(dataInput.readBytes(tableLength)); final int masterBytesLength = dataInput.readInt(); final byte[] masterBytes = dataInput.readBytes(masterBytesLength); final DerefMapVariantPropertiesPattern variantPropertiesPattern = deserializeVariantPropertiesPattern(dataInput); result.add(new DependencyEntry(new AbsoluteRecordIdImpl(table, idGenerator.newRecordId(idGenerator.fromBytes(masterBytes), variantPropertiesPattern.getConcreteProperties())), variantPropertiesPattern.getPatternProperties())); } return result; }
/** * 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; }
recordId = idGenerator.newRecordId();
record.setId(repository.getIdGenerator().newRecordId());