-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1693 VersionedModelControllerV3:
/{name}/{version}/validation
impl…
… added. IT mostly adjusted, but there are todos - DatasetServiceV3 introduced to carry difference in behavior to DatasetService. original entity validation has been divided into create-validation and regular-entity validation. - buildfix for VersionedModelServiceTest
- Loading branch information
Showing
7 changed files
with
247 additions
and
51 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
49 changes: 49 additions & 0 deletions
49
rest-api/src/main/scala/za/co/absa/enceladus/rest_api/services/v3/DatasetServiceV3.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,49 @@ | ||
/* | ||
* Copyright 2018 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.enceladus.rest_api.services.v3 | ||
|
||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Service | ||
import za.co.absa.enceladus.model.{Dataset, Validation} | ||
import za.co.absa.enceladus.rest_api.repositories.{DatasetMongoRepository, OozieRepository} | ||
import za.co.absa.enceladus.rest_api.services.{DatasetService, PropertyDefinitionService} | ||
|
||
import scala.concurrent.Future | ||
|
||
|
||
// this DatasetService is a V3 difference wrapper - once V2 is removed, implementations can/should be merged | ||
@Service | ||
class DatasetServiceV3 @Autowired()(datasetMongoRepository: DatasetMongoRepository, | ||
oozieRepository: OozieRepository, | ||
datasetPropertyDefinitionService: PropertyDefinitionService) | ||
extends DatasetService(datasetMongoRepository, oozieRepository, datasetPropertyDefinitionService) { | ||
|
||
import scala.concurrent.ExecutionContext.Implicits.global | ||
|
||
// general entity validation is extendable for V3 - here with properties validation | ||
override def validate(item: Dataset): Future[Validation] = { | ||
// todo check schema presence same way as for import | ||
|
||
for { | ||
originalValidation <- super.validate(item) | ||
dsSpecificValidation <- validateProperties(item.propertiesAsMap) | ||
} yield originalValidation.merge(dsSpecificValidation) | ||
} | ||
|
||
|
||
} | ||
|
||
|
Oops, something went wrong.