-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#87: DTOs for measures and measure results, MeasurementBuilder, Agent…
… refactored
- Loading branch information
1 parent
2df96ab
commit 6a9d5d3
Showing
18 changed files
with
113 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
agent/src/main/scala/za/co/absa/atum/agent/model/MeasurementBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package za.co.absa.atum.agent.model | ||
|
||
import za.co.absa.atum.model.dto.{MeasureDTO, MeasureResultDTO, MeasurementDTO} | ||
import za.co.absa.atum.model.dto.MeasureResultDTO.{ResultValueType, TypedValue} | ||
|
||
object MeasurementBuilder { | ||
|
||
def buildLongMeasurement(functionName: String, controlCols: Seq[String], resultValue: Long): MeasurementDTO = { | ||
MeasurementDTO( | ||
MeasureDTO(functionName, controlCols), | ||
MeasureResultDTO(TypedValue(resultValue.toString, ResultValueType.Long)) | ||
) | ||
} | ||
|
||
def buildDoubleMeasureResult(functionName: String, controlCols: Seq[String], resultValue: Double): MeasurementDTO = { | ||
MeasurementDTO( | ||
MeasureDTO(functionName, controlCols), | ||
MeasureResultDTO(TypedValue(resultValue.toString, ResultValueType.Double)) | ||
) | ||
} | ||
|
||
def buildBigDecimalMeasureResult(functionName: String, controlCols: Seq[String], resultValue: BigDecimal): MeasurementDTO = { | ||
MeasurementDTO( | ||
MeasureDTO(functionName, controlCols), | ||
MeasureResultDTO(TypedValue(resultValue.toString, ResultValueType.BigDecimal)) | ||
) | ||
} | ||
|
||
def buildStringMeasureResult(functionName: String, controlCols: Seq[String], resultValue: String): MeasurementDTO = { | ||
MeasurementDTO( | ||
MeasureDTO(functionName, controlCols), | ||
MeasureResultDTO(TypedValue(resultValue, ResultValueType.String)) | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
model/src/main/scala/za/co/absa/atum/model/MeasureResult.scala
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
model/src/main/scala/za/co/absa/atum/model/Partitioning.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
model/src/main/scala/za/co/absa/atum/model/dto/MeasureResultDTO.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package za.co.absa.atum.model.dto | ||
|
||
import com.fasterxml.jackson.core.`type`.TypeReference | ||
import com.fasterxml.jackson.module.scala.JsonScalaEnumeration | ||
import za.co.absa.atum.model.dto.MeasureResultDTO.TypedValue | ||
|
||
case class MeasureResultDTO( | ||
mainValue: TypedValue, | ||
supportValues: Map[String, TypedValue] = Map.empty | ||
) | ||
|
||
|
||
object MeasureResultDTO { | ||
case class TypedValue( | ||
value: String, | ||
@JsonScalaEnumeration(classOf[ResultValueType]) valueType: ResultValueType.ResultValueType | ||
) | ||
|
||
class ResultValueType extends TypeReference[ResultValueType.type] | ||
|
||
object ResultValueType extends Enumeration { | ||
type ResultValueType = Value | ||
val String, Long, BigDecimal, Double = Value | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters