Class DiagnosisKeyBuilder
- java.lang.Object
-
- app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilder
-
- All Implemented Interfaces:
app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder
,app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
,app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder
,app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder
public class DiagnosisKeyBuilder extends Object implements app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder, app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder, app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder, app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
An instance of this builder can be retrieved by callingDiagnosisKey.builder()
. ADiagnosisKey
can then be build by either providing the required member values or by passing the respective protocol buffer object.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiagnosisKey
build()
Builds aDiagnosisKey
instance.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
fromProtoBuf(TemporaryExposureKey protoBufObject)
Adds the data contained in the specified protocol buffers key object to this builder.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder
withKeyData(byte[] keyData)
Adds the specified key data to this builder.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
withRollingPeriod(int rollingPeriod)
Adds the specified rolling period to this builder.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder
withRollingStartIntervalNumber(int rollingStartIntervalNumber)
Adds the specified rolling start interval number to this builder.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
withSubmissionTimestamp(long submissionTimestamp)
Adds the specified submission timestamp that is expected to represent hours since epoch.app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
withTransmissionRiskLevel(int transmissionRiskLevel)
Adds the specified transmission risk level to this builder.
-
-
-
Method Detail
-
withKeyData
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder withKeyData(byte[] keyData)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder
Adds the specified key data to this builder.- Specified by:
withKeyData
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder
- Parameters:
keyData
- generated diagnosis key.- Returns:
- this Builder instance.
-
withRollingStartIntervalNumber
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder withRollingStartIntervalNumber(int rollingStartIntervalNumber)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder
Adds the specified rolling start interval number to this builder.- Specified by:
withRollingStartIntervalNumber
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.RollingStartIntervalNumberBuilder
- Parameters:
rollingStartIntervalNumber
- number describing when a key starts. It is equal to startTimeOfKeySinceEpochInSecs / (60 * 10).- Returns:
- this Builder instance.
-
withTransmissionRiskLevel
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder withTransmissionRiskLevel(int transmissionRiskLevel)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder
Adds the specified transmission risk level to this builder.- Specified by:
withTransmissionRiskLevel
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.TransmissionRiskLevelBuilder
- Parameters:
transmissionRiskLevel
- risk of transmission associated with the person this key came from.- Returns:
- this Builder instance.
-
fromProtoBuf
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder fromProtoBuf(TemporaryExposureKey protoBufObject)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder
Adds the data contained in the specified protocol buffers key object to this builder.- Specified by:
fromProtoBuf
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.Builder
- Parameters:
protoBufObject
- ProtocolBuffer object associated with the temporary exposure key.- Returns:
- this Builder instance.
-
withSubmissionTimestamp
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder withSubmissionTimestamp(long submissionTimestamp)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
Adds the specified submission timestamp that is expected to represent hours since epoch.- Specified by:
withSubmissionTimestamp
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
- Parameters:
submissionTimestamp
- timestamp in hours since epoch.- Returns:
- this Builder instance.
-
withRollingPeriod
public app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder withRollingPeriod(int rollingPeriod)
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
Adds the specified rolling period to this builder. If not specified, the rolling period defaults toDiagnosisKey.EXPECTED_ROLLING_PERIOD
- Specified by:
withRollingPeriod
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
- Parameters:
rollingPeriod
- Number describing how long a key is valid. It is expressed in increments of 10 minutes (e.g. 144 for 24 hours).- Returns:
- this Builder instance.
-
build
public DiagnosisKey build()
Description copied from interface:app.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
Builds aDiagnosisKey
instance. If no submission timestamp has been specified it will be set to "now" as hours since epoch.- Specified by:
build
in interfaceapp.coronawarn.server.common.persistence.domain.DiagnosisKeyBuilders.FinalBuilder
-
-