public Builder mergeFrom(datawave.edge.protobuf.EdgeData.EdgeValue other) { if (other == datawave.edge.protobuf.EdgeData.EdgeValue.getDefaultInstance()) return this; if (other.hasCount()) { setCount(other.getCount()); if (other.hasHourBitmask()) { setHourBitmask(other.getHourBitmask()); if (other.hasSourceValue()) { bitField0_ |= 0x00000010; sourceValue_ = other.sourceValue_; onChanged(); if (other.hasSinkValue()) { bitField0_ |= 0x00000020; sinkValue_ = other.sinkValue_; onChanged(); if (other.hasLoadDate()) { bitField0_ |= 0x00000040; loadDate_ = other.loadDate_; onChanged(); if (other.hasBadActivity()) { setBadActivity(other.getBadActivity()); if (other.hasUuid()) { mergeUuid(other.getUuid());
if (!getHoursList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); if (!getDurationList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, getSourceValueBytes()); size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getSinkValueBytes()); size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getLoadDateBytes()); size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getUuidStringBytes()); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size;
/** * Determines the oldest load date and updates the builder with it * * @param builder * will be updated by this method with the oldest load date * @param protoEdgeValue * the current value, decoded */ private void useEarliestLoadDate(Key key, EdgeValueBuilder builder, EdgeData.EdgeValue protoEdgeValue) { String loadDate = builder.getLoadDate(); if (protoEdgeValue.hasLoadDate()) { if (null == loadDate || loadDate.compareTo(protoEdgeValue.getLoadDate()) > 0) { builder.setLoadDate(protoEdgeValue.getLoadDate()); } } else if (null == loadDate) { builder.setLoadDate(getDateFromKey(key)); } }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, count_); if (getHoursList().size() > 0) { output.writeRawVarint32(18); output.writeRawVarint32(hoursMemoizedSerializedSize); output.writeInt64NoTag(hours_.get(i)); if (getDurationList().size() > 0) { output.writeRawVarint32(26); output.writeRawVarint32(durationMemoizedSerializedSize); output.writeBytes(5, getSourceValueBytes()); output.writeBytes(6, getSinkValueBytes()); output.writeBytes(7, getLoadDateBytes()); output.writeBytes(10, getUuidStringBytes()); getUnknownFields().writeTo(output);
EdgeData.EdgeValue proto = EdgeData.EdgeValue.parseFrom(value.get()); if (proto.hasCount()) { builder.setCount(proto.getCount()); } else { builder.setCount(0l); if (proto.hasHourBitmask()) { builder.setBitmask(proto.getHourBitmask()); if (proto.hasSourceValue()) { builder.setSourceValue(proto.getSourceValue()); if (proto.hasSinkValue()) { builder.setSinkValue(proto.getSinkValue()); List<Long> hoursList = proto.getHoursList(); if (hoursList != null && hoursList.isEmpty() == false) { builder.setHours(hoursList); List<Long> durationList = proto.getDurationList(); if (durationList != null && durationList.isEmpty() == false) { builder.setDuration(durationList); if (proto.hasLoadDate()) { builder.setLoadDate(proto.getLoadDate()); if (proto.hasUuid()) { builder.setOnlyUuidString(false);
Value value = iter.next(); try { EdgeData.EdgeValue protoEdgeValue = EdgeData.EdgeValue.parseFrom(value.get()); if (protoEdgeValue.hasCount()) { builder.setCount(protoEdgeValue.getCount() + builder.getCount()); if (protoEdgeValue.hasHourBitmask()) { builder.combineBitmask(protoEdgeValue.getHourBitmask());
private void combineBadActivityDate(EdgeValueBuilder builder, EdgeData.EdgeValue protoEdgeValue) { // Only set the bad activity flag if one of the edges to be combined contains the bad activity flag. // This should only happen with the new EVENT_ONLY date type edges if (protoEdgeValue.hasBadActivity()) { if (builder.badActivityDateSet()) { // If one of the activity dates is good then the edge will be treated as good // They all must be bad for it to be treated as a bad activity date. builder.setBadActivityDate(builder.isBadActivityDate() && protoEdgeValue.getBadActivity()); } else { builder.setBadActivityDate(protoEdgeValue.getBadActivity()); } } } }
private void useEarliestUuid(EdgeValueBuilder builder, EdgeData.EdgeValue protoEdgeValue) { // Keeps overriding value of 'uuid' so the last(earliest) one will always be used // the value corresponding to the key with the most recent timestamp will come first // the value corresponding to the key with the oldest timestamp will come last if (protoEdgeValue.hasUuid()) { // previously, we took uuid from proto.EdgeValue, converted it to UUID, then to String // then when encoding we converted it back to a UUID and then into a UUID builder builder.setUuidObj(protoEdgeValue.getUuid()); builder.setOnlyUuidString(false); } else if (protoEdgeValue.hasUuidString()) { builder.setOnlyUuidString(true); builder.setUuid(protoEdgeValue.getUuidString()); } }
public static List<Long> decodeActivityHistogram(Value value) { try { return decodeActivityHistogram(EdgeData.EdgeValue.parseFrom(value.get()).getHoursList()); } catch (InvalidProtocolBufferException e) { // Probably an old edge value return decodeActivityHistogram(getVarLongList(value.get())); } }
/** * <code>optional string uuid_string = 10;</code> * * <pre> * a single uuid of an event that contributed to the edge in string format * </pre> */ public Builder clearUuidString() { bitField0_ = (bitField0_ & ~0x00000200); uuidString_ = getDefaultInstance().getUuidString(); onChanged(); return this; }
public static List<Long> decodeDurationHistogram(Value value) { try { return decodeDurationHistogram(EdgeData.EdgeValue.parseFrom(value.get()).getDurationList()); } catch (InvalidProtocolBufferException e) { // Probably an old edge value return decodeDurationHistogram(getVarLongList(value.get())); } }
/** * <code>optional string loadDate = 7;</code> */ public Builder clearLoadDate() { bitField0_ = (bitField0_ & ~0x00000040); loadDate_ = getDefaultInstance().getLoadDate(); onChanged(); return this; }
/** * <code>optional string sourceValue = 5;</code> */ public Builder clearSourceValue() { bitField0_ = (bitField0_ & ~0x00000010); sourceValue_ = getDefaultInstance().getSourceValue(); onChanged(); return this; }
private void combineHistogram(STATS_TYPE statsType, EdgeValueBuilder builder, List<Long> combinedList, EdgeData.EdgeValue protoEdgeValue) { if (STATS_TYPE.ACTIVITY == statsType) { List<Long> sourceList = EdgeValueHelper.decodeActivityHistogram(protoEdgeValue.getHoursList()); EdgeValueHelper.combineHistogram(sourceList, combinedList); builder.setHours(combinedList); } else if (STATS_TYPE.DURATION == statsType) { List<Long> sourceList = EdgeValueHelper.decodeDurationHistogram(protoEdgeValue.getDurationList()); EdgeValueHelper.combineHistogram(sourceList, combinedList); builder.setDuration(combinedList); } }
/** * <code>optional string sinkValue = 6;</code> */ public Builder clearSinkValue() { bitField0_ = (bitField0_ & ~0x00000020); sinkValue_ = getDefaultInstance().getSinkValue(); onChanged(); return this; }
private void combineSourceAndSink(EdgeValueBuilder builder, EdgeData.EdgeValue protoEdgeValue) { if (StringUtils.isBlank(builder.getSourceValue()) && protoEdgeValue.hasSourceValue()) { builder.setSourceValue(protoEdgeValue.getSourceValue()); } if (StringUtils.isBlank(builder.getSinkValue()) && protoEdgeValue.hasSinkValue()) { builder.setSinkValue(protoEdgeValue.getSinkValue()); } }