for (FieldedLink link : addedLinks) { IndexEntry fwdEntry = createForwardIndexEntry(vtag, sourceRecord, link.getFieldTypeId()); fwdEntry.setIdentifier(link.getAbsoluteRecordId().toBytes()); fwdEntries.add(fwdEntry); bkwdEntry.setIdentifier(sourceAsBytes); bkwdEntries.add(bkwdEntry); bkwdEntry.setIdentifier(sourceAsBytes); bkwdEntries.add(bkwdEntry); fwdEntry.setIdentifier(link.getAbsoluteRecordId().toBytes()); fwdEntries.add(fwdEntry);
for (FieldedLink link : oldLinks) { IndexEntry entry = createBackwardIndexEntry(vtag, link.getAbsoluteRecordId(), link.getFieldTypeId()); entry.setIdentifier(sourceAsBytes); entries.add(entry); for (FieldedLink link : oldLinks) { IndexEntry entry = createForwardIndexEntry(vtag, sourceRecord, link.getFieldTypeId()); entry.setIdentifier(link.getAbsoluteRecordId().toBytes()); entries.add(entry);
IndexEntry entry = createBackwardIndexEntry(link.getV2(), link.getV1().getAbsoluteRecordId(), link.getV1().getFieldTypeId()); entry.setIdentifier(sourceAsBytes); entries.add(entry); for (Pair<FieldedLink, SchemaId> link : oldLinks) { IndexEntry entry = createForwardIndexEntry(link.getV2(), sourceRecord, link.getV1().getFieldTypeId()); entry.setIdentifier(link.getV1().getAbsoluteRecordId().toBytes()); entries.add(entry);
private IndexEntry createForwardEntry(AbsoluteRecordId parentRecordId, SchemaId parentVtagId, Collection<DependencyEntry> newDependencies) throws IOException { final IndexEntry fwdEntry = new IndexEntry(forwardDerefIndex.getDefinition()); fwdEntry.addField("dependant_recordid", parentRecordId.toBytes()); fwdEntry.addField("dependant_vtag", parentVtagId.getBytes()); // we do not really use the identifier... all we are interested in is in the data of the entry fwdEntry.setIdentifier(DUMMY_IDENTIFIER); // the data contains the dependencies of the dependant (master record ids and vtags) fwdEntry.addData(DEPENDENCIES_KEY, this.serializationUtil.serializeDependenciesForward(newDependencies)); return fwdEntry; }
private IndexEntry createBackwardEntry(AbsoluteRecordId parentRecordId, AbsoluteRecordId dependantRecordId, SchemaId dependantVtagId, Set<SchemaId> fields, Set<String> moreDimensionedVariantProperties) throws IOException { final byte[] serializedVariantPropertiesPattern = this.serializationUtil.serializeVariantPropertiesPattern( this.serializationUtil.createVariantPropertiesPattern(parentRecordId.getRecordId().getVariantProperties(), moreDimensionedVariantProperties)); final IndexEntry bwdEntry = new IndexEntry(backwardDerefIndex.getDefinition()); bwdEntry.addField("dependency_masterrecordid", parentRecordId.getRecordId().getMaster().toBytes()); bwdEntry.addField("dependant_vtag", dependantVtagId.getBytes()); bwdEntry.addField("variant_properties_pattern", serializedVariantPropertiesPattern); // the identifier is the dependant which depends on the dependency bwdEntry.setIdentifier(dependantRecordId.toBytes()); // the fields which the dependant uses of the dependency (null if used for deleting the entry) if (fields != null) { bwdEntry.addData(FIELDS_KEY, this.serializationUtil.serializeFields(fields)); } return bwdEntry; }