Index: WSimpl/Halux/PPS/MatService.cls.xml =================================================================== diff -u -r66751 -r66753 --- WSimpl/Halux/PPS/MatService.cls.xml (.../MatService.cls.xml) (revision 66751) +++ WSimpl/Halux/PPS/MatService.cls.xml (.../MatService.cls.xml) (revision 66753) @@ -41,32 +41,28 @@ Try { #dim BatchId As %Integer = GeefAfmetingenRequest.BatchId - If ($$$Not(BatchId = "")) { - #dim Batch As APPS.Halux.common.Batch = ..BatchService.GeefBatch(BatchId) - #dim Categorie As APPS.Halux.common.enu.Categorie = Batch.GeefCategorie() + If (BatchId = "") { + Do ##class(TECH.Exceptions.InvalidInputException).Throw("Geen BatchId meegegeven.") + } - If (..IsCategorieOndersteund(Categorie)) { - #dim MatAfmetingenIterator As TECH.Iterator = ..MatInfoRepository.ZoekViaBatchId(BatchId) + #dim Batch As APPS.Halux.common.Batch = ..BatchService.GeefBatch(BatchId) + #dim Categorie As APPS.Halux.common.enu.Categorie = Batch.GeefCategorie() - If MatAfmetingenIterator.HasNext() { - Set Response.Header.Status = "200" - Set Response.BatchId = BatchId - Set Response.Categorie = Categorie - While MatAfmetingenIterator.HasNext() { - Do Response.MatAfmetingen.Insert(..MatAfmetingenUitvoeringInfoNaarDto(MatAfmetingenIterator.Next())) - } - - } Else { - Set Response.Header.Status = ##class(TECH.enu.ExceptionCode).DataNotFound() - Set Response.Header.Omschrijving = "Geen data gevonden voor Batch met id '"_GeefAfmetingenRequest.BatchId_"'." - } - } Else { - Set Response.Header.Status = ##class(TECH.enu.ExceptionCode).Unimplemented() - Set Response.Header.Omschrijving = "MatService is niet geïmplementeerd voor Categorie '" _ Categorie _ "'." + If (..IsCategorieOndersteund(Categorie)) { + #dim MatAfmetingenIterator As TECH.Iterator = ..MatInfoRepository.ZoekViaBatchId(BatchId) + + If $$$Not(MatAfmetingenIterator.HasNext()) { + Do ##class(TECH.Exceptions.DataNotFoundException).Throw("Geen data gevonden voor Batch met id '"_GeefAfmetingenRequest.BatchId_"'.") } + + Set Response.Header.Status = "200" + Set Response.BatchId = BatchId + Set Response.Categorie = Categorie + While MatAfmetingenIterator.HasNext() { + Do Response.MatAfmetingen.Insert(..MatAfmetingenUitvoeringInfoNaarDto(MatAfmetingenIterator.Next())) + } } Else { - Set Response.Header.Status = ##class(TECH.enu.ExceptionCode).InvalidInput() - Set Response.Header.Omschrijving = "Geen BatchId meegegeven." + Do ##class(TECH.Exceptions.UnimplementedException).Throw("MatService is niet geïmplementeerd voor Categorie '" _ Categorie _ "'.") } } Catch { #dim Exception As TECH.Exceptions.Exception = ##class(TECH.ExceptionHandler).Catch()