-
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.
- Loading branch information
Showing
23 changed files
with
403 additions
and
45 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
32 changes: 32 additions & 0 deletions
32
model/src/main/scala/za/co/absa/atum/model/dto/traits/CheckpointCore.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,32 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.model.dto.traits | ||
|
||
import za.co.absa.atum.model.dto.MeasurementDTO | ||
|
||
import java.time.ZonedDateTime | ||
import java.util.UUID | ||
|
||
trait CheckpointCore { | ||
def id: UUID | ||
def name: String | ||
def author: String | ||
def measuredByAtumAgent: Boolean | ||
def processStartTime: ZonedDateTime | ||
def processEndTime: Option[ZonedDateTime] | ||
def measurements: Set[MeasurementDTO] | ||
} |
46 changes: 46 additions & 0 deletions
46
model/src/main/scala/za/co/absa/atum/model/types/Checkpoint.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,46 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.model.types | ||
|
||
import za.co.absa.atum.model.dto.traits.CheckpointCore | ||
|
||
import java.time.ZonedDateTime | ||
import java.util.UUID | ||
|
||
case class Checkpoint ( | ||
id: UUID, | ||
name: String, | ||
author: String, | ||
measuredByAtumAgent: Boolean = false, | ||
processStartTime: ZonedDateTime, | ||
processEndTime: Option[ZonedDateTime], | ||
measurements: Set[Measurement] | ||
) | ||
|
||
object Checkpoint { | ||
def apply(from: CheckpointCore): Checkpoint = { | ||
new Checkpoint( | ||
id = from.id, | ||
name = from.name, | ||
author = from.author, | ||
measuredByAtumAgent = from.measuredByAtumAgent, | ||
processStartTime = from.processStartTime, | ||
processEndTime = from.processEndTime, | ||
measurements = from.measurements.map() | ||
) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
model/src/main/scala/za/co/absa/atum/model/types/Measurement.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,37 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.model.types | ||
|
||
import za.co.absa.atum.model.ResultValueType | ||
import za.co.absa.atum.model.dto.MeasurementDTO | ||
|
||
case class Measurement[T] ( | ||
measureName: String, | ||
measuredColumns: Seq[String], | ||
valueType: ResultValueType, | ||
value: T | ||
) | ||
|
||
object Measurement { | ||
def apply[T](from: MeasurementDTO): Measurement = { | ||
new Measurement( | ||
measureName = from.measure.measureName, | ||
measuredColumns = from.measure.measuredColumns, | ||
value = from.result.mainValue.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
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
19 changes: 19 additions & 0 deletions
19
reader/src/main/scala/za/co/absa/atum/reader/exceptions/ReaderException.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,19 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.reader.exceptions | ||
|
||
class ReaderException(message: String) extends Exception(message) |
50 changes: 50 additions & 0 deletions
50
reader/src/main/scala/za/co/absa/atum/reader/exceptions/RequestException.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,50 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.reader.exceptions | ||
|
||
import sttp.client3.HttpError | ||
import sttp.model.{StatusCode, Uri} | ||
import za.co.absa.atum.model.envelopes.ErrorResponse | ||
|
||
abstract class RequestException(message: String) extends ReaderException(message) | ||
|
||
|
||
object RequestException { | ||
type CirceError = io.circe.Error | ||
|
||
final case class HttpException( | ||
message: String, | ||
statusCode: StatusCode, | ||
errorResponse: ErrorResponse, | ||
request: Uri | ||
) extends RequestException(message) | ||
|
||
final case class ParsingException( | ||
message: String, | ||
body: String | ||
) extends RequestException(message) | ||
object ParsingException { | ||
def fromCirceError(error: CirceError, body: String): ParsingException = { | ||
ParsingException(error.getMessage, body) | ||
} | ||
} | ||
|
||
|
||
final case class NoDataException( | ||
message: String | ||
) extends RequestException(message) | ||
} |
30 changes: 30 additions & 0 deletions
30
reader/src/main/scala/za/co/absa/atum/reader/implicits/EitherImplicits.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,30 @@ | ||
/* | ||
* Copyright 2024 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.atum.reader.implicits | ||
|
||
import sttp.monad.MonadError | ||
|
||
object EitherImplicits { | ||
|
||
implicit class EitherMonadEnhancements[A, B](val either: Either[A, B]) extends AnyVal { | ||
def project[C, F[_]: MonadError](f: B => F[Either[A, C]]): F[Either[A, C]] = either match { | ||
case Right(b) => f(b) | ||
case Left(a) => implicitly[MonadError[F]].unit(Left(a)) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.