From fa841b8902ff29dc3d3e8c7dccd93d7b5b2b827f Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Thu, 28 Sep 2017 18:27:34 +0700 Subject: Formatted code by scalafmt --- .../pdsuicommon/utils/CustomSwaggerJsonFormats.scala | 13 ------------- .../pdsuidomain/fakes/entities/rep/Common.scala | 20 +++++++------------- .../pdsuidomain/fakes/entities/rep/DocumentGen.scala | 12 +++++------- .../fakes/entities/rep/ExportPatientGen.scala | 8 ++++---- .../fakes/entities/rep/ExtractedDataGen.scala | 12 ++++-------- .../fakes/entities/rep/MedicalRecordGen.scala | 12 +++++------- 6 files changed, 25 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala index f2c6d94..538618b 100644 --- a/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala +++ b/src/main/scala/xyz/driver/pdsuicommon/utils/CustomSwaggerJsonFormats.scala @@ -69,7 +69,6 @@ object CustomSwaggerJsonFormats { import xyz.driver.pdsuidomain.formats.json.sprayformats.bridgeuploadqueue import xyz.driver.pdsuidomain.formats.json.sprayformats.extracteddata - val customRepObjectsExamples = immutable.Map[Class[_], JsValue]( classOf[Document] -> document.documentFormat.write(rep.DocumentGen.nextDocument()), @@ -81,20 +80,16 @@ object CustomSwaggerJsonFormats { document.requiredTypeFormat.write(rep.DocumentGen.nextDocumentRequiredType()), classOf[Document.Status] -> document.documentStatusFormat.write(rep.DocumentGen.nextDocumentStatus()), - classOf[DocumentIssue] -> documentissue.documentIssueFormat.write(rep.DocumentGen.nextDocumentIssue()), - classOf[DocumentHistory] -> documenthistory.documentHistoryFormat.write(rep.DocumentGen.nextDocumentHistory()), classOf[DocumentHistory.Action] -> documenthistory.documentActionFormat.write(rep.DocumentGen.nextDocumentHistoryAction()), classOf[DocumentHistory.State] -> documenthistory.documentStateFormat.write(rep.DocumentGen.nextDocumentHistoryState()), - classOf[ProviderType] -> providertype.providerTypeFormat.write(rep.ProviderTypeGen.nextProviderType()), - classOf[TextJson[List[MedicalRecord.Meta]]] -> record.recordMetaFormat.write(rep.MedicalRecordGen.nextMedicalRecordMetasJson()), classOf[MedicalRecord] -> @@ -103,20 +98,16 @@ object CustomSwaggerJsonFormats { record.recordMetaTypeFormat.write(rep.MedicalRecordGen.nextMedicalRecordMeta()), classOf[MedicalRecord.Status] -> record.recordStatusFormat.write(rep.MedicalRecordGen.nextMedicalRecordStatus()), - classOf[MedicalRecordIssue] -> recordissue.recordIssueFormat.write(rep.MedicalRecordGen.nextMedicalRecordIssue()), - classOf[MedicalRecordHistory] -> recordhistory.recordHistoryFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistory()), classOf[MedicalRecordHistory.Action] -> recordhistory.recordActionFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistoryAction()), classOf[MedicalRecordHistory.State] -> recordhistory.recordStateFormat.write(rep.MedicalRecordGen.nextMedicalRecordHistoryState()), - classOf[BridgeUploadQueue.Item] -> bridgeuploadqueue.queueUploadItemFormat.write(rep.BridgeUploadQueueGen.nextBridgeUploadQueueItem()), - classOf[ExtractedData.Meta] -> extracteddata.extractedDataMetaFormat.write(rep.ExtractedDataGen.nextExtractedDataMeta()), classOf[ExtractedData.Meta.Evidence] -> @@ -125,17 +116,13 @@ object CustomSwaggerJsonFormats { extracteddata.metaKeywordFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaKeyword()), classOf[ExtractedData.Meta.TextLayerPosition] -> extracteddata.metaTextLayerPositionFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaTextLayerPosition()), - classOf[TextJson[ExtractedData.Meta]] -> extracteddata.fullExtractedDataMetaFormat.write(rep.ExtractedDataGen.nextExtractedDataMetaJson()), - classOf[RichExtractedData] -> extracteddata.extractedDataFormat.write(rep.ExtractedDataGen.nextRichExtractedData()), - classOf[ExtractedDataLabel] -> extracteddata.extractedDataLabelWriter.write(rep.ExtractedDataGen.nextExtractedDataLabel()) ) } - } diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/Common.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/Common.scala index 337dc2b..9618eed 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/Common.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/Common.scala @@ -5,26 +5,20 @@ import xyz.driver.core.generators._ import xyz.driver.pdsuicommon.domain.FuzzyValue private[rep] object Common { - def genBoundedRange[T](from: T, - to: T) - (implicit ord: Ordering[T]): (T, T) = { + def genBoundedRange[T](from: T, to: T)(implicit ord: Ordering[T]): (T, T) = { if (ord.compare(from, to) > 0) { to -> from - } - else { + } else { from -> to } } - def genBoundedRangeOption[T](from: T, - to: T) - (implicit ord: Ordering[T]): (Option[T], Option[T]) = { + def genBoundedRangeOption[T](from: T, to: T)(implicit ord: Ordering[T]): (Option[T], Option[T]) = { val ranges = nextOption(from) - .map(left => - genBoundedRange(left, to) - ) - .map { case (left, right) => - left -> nextOption(right) + .map(left => genBoundedRange(left, to)) + .map { + case (left, right) => + left -> nextOption(right) } ranges.map(_._1) -> ranges.flatMap(_._2) diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala index 0d32495..10349bb 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala @@ -1,6 +1,5 @@ package xyz.driver.pdsuidomain.fakes.entities.rep - import java.time.LocalDate import xyz.driver.core.generators @@ -10,8 +9,7 @@ import xyz.driver.pdsuidomain.entities._ import xyz.driver.pdsuidomain.fakes.entities.common.{nextLocalDate, nextLocalDateTime, nextLongId, nextStringId} object DocumentGen { - implicit private class LocalDateOrdering(localData: LocalDate) - extends Ordered[LocalDate] { + implicit private class LocalDateOrdering(localData: LocalDate) extends Ordered[LocalDate] { override def compare(that: LocalDate): Int = { this.localData.compareTo(that) @@ -25,8 +23,7 @@ object DocumentGen { Common.nextStartAndEndPages private def nextStartAndEndPage() = - Common.genBoundedRange(nextDouble(),nextDouble()) - + Common.genBoundedRange(nextDouble(), nextDouble()) def nextDocumentStatus(): Document.Status = Document.Status.New @@ -44,7 +41,9 @@ object DocumentGen { val (startPage, endPage) = nextStartAndEndPage() Document.Meta( - nextOption(nextBoolean()), startPage, endPage + nextOption(nextBoolean()), + startPage, + endPage ) } @@ -98,7 +97,6 @@ object DocumentGen { ) } - def nextDocumentHistory(documentId: LongId[Document] = nextLongId): DocumentHistory = { DocumentHistory( id = nextLongId[DocumentHistory], diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala index 4a4164a..7259d0c 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExportPatientGen.scala @@ -4,10 +4,10 @@ import xyz.driver.core.generators._ import xyz.driver.pdsuicommon.domain.{LongId, UuidId} import xyz.driver.pdsuidomain.entities.{Document, ExtractedData, Label, RecordRequestId} import xyz.driver.pdsuidomain.entities.export.patient.{ -ExportPatientLabel, -ExportPatientLabelEvidence, -ExportPatientLabelEvidenceDocument, -ExportPatientWithLabels + ExportPatientLabel, + ExportPatientLabelEvidence, + ExportPatientLabelEvidenceDocument, + ExportPatientWithLabels } import xyz.driver.pdsuidomain.fakes.entities.common.{nextLocalDate, nextLongId} diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala index 0d99d19..8ac07d0 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/ExtractedDataGen.scala @@ -1,6 +1,5 @@ package xyz.driver.pdsuidomain.fakes.entities.rep - import xyz.driver.core.generators._ import xyz.driver.pdsuicommon.domain.{LongId, TextJson} import xyz.driver.pdsuidomain.entities._ @@ -8,16 +7,15 @@ import xyz.driver.pdsuidomain.entities.ExtractedData.Meta import xyz.driver.pdsuidomain.fakes.entities.common._ import xyz.driver.pdsuidomain.services.ExtractedDataService.RichExtractedData - object ExtractedDataGen { private val maxItemsInCollectionNumber = 50 - private val maxPageNumber = 100 - private val maxIndexNumber = 100 + private val maxPageNumber = 100 + private val maxIndexNumber = 100 private val maxOffsetNumber = 10 implicit private class TextLayerPositionOrdering(textLayerPosition: ExtractedData.Meta.TextLayerPosition) - extends Ordered[ExtractedData.Meta.TextLayerPosition] { + extends Ordered[ExtractedData.Meta.TextLayerPosition] { override def compare(that: Meta.TextLayerPosition): Int = { if (this.textLayerPosition.page < that.page) -1 else if (this.textLayerPosition.page > that.page) 1 @@ -56,7 +54,7 @@ object ExtractedDataGen { ExtractedData.Meta.Evidence( pageRatio = nextDouble(), start = layersPosition._1, - end = layersPosition._2 + end = layersPosition._2 ) } @@ -76,7 +74,6 @@ object ExtractedDataGen { ) } - def nextExtractedData(documentId: LongId[Document]): ExtractedData = { ExtractedData( id = nextLongId[ExtractedData], @@ -87,7 +84,6 @@ object ExtractedDataGen { ) } - def nextExtractedDataLabel(): ExtractedDataLabel = { ExtractedDataLabel( id = nextLongId[ExtractedDataLabel], diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala index 90c98c3..7221e66 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala @@ -39,7 +39,6 @@ object MedicalRecordGen { TextJson(documents.map(_.copy(recordId = recordId))) } - def nextMedicalRecordStatus(): MedicalRecord.Status = MedicalRecord.Status.New @@ -49,7 +48,6 @@ object MedicalRecordGen { def nextMedicalRecordHistoryAction(): MedicalRecordHistory.Action = generators.oneOf[MedicalRecordHistory.Action](MedicalRecordHistory.Action.All) - def nextMedicalRecordMetaReorder(): MedicalRecord.Meta.Reorder = { val itemsNumber = maxItemsInCollectionNumber @@ -62,7 +60,6 @@ object MedicalRecordGen { ) } - def nextMedicalRecordMetaDuplicate(): MedicalRecord.Meta.Duplicate = { val startPageGen = nextInt(pageMaxNumber, minValue = 0) @@ -80,9 +77,11 @@ object MedicalRecordGen { def nextMedicalRecordMetaRotation(): MedicalRecord.Meta.Rotation = { val items = - Array.tabulate(maxItemsInCollectionNumber)( - index => nextString() -> index - ).toMap + Array + .tabulate(maxItemsInCollectionNumber)( + index => nextString() -> index + ) + .toMap MedicalRecord.Meta.Rotation( predicted = nextOption(nextBoolean()), @@ -94,7 +93,6 @@ object MedicalRecordGen { generators.oneOf(medicalRecordMetas)() } - def nextMedicalRecord(): MedicalRecord = { val id = nextLongId[MedicalRecord] MedicalRecord( -- cgit v1.2.3