Skip to content

Commit

Permalink
DatasetFieldServiceApi#loadNAControlledVocabularyValue now returns a …
Browse files Browse the repository at this point in the history
…proper http response (#298)
  • Loading branch information
michbarsinai committed Mar 3, 2015
1 parent dd5d081 commit c391096
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,17 @@ public Response showControlledVocabularyForSubject() {

@GET
@Path("loadNAControlledVocabularyValue")
public void loadNAControlledVocabularyValue() {
public Response loadNAControlledVocabularyValue() {
// the find will throw a javax.persistence.NoResultException if no values are in db
try {
datasetFieldService.findNAControlledVocabularyValue();
return okResponse("NA value exists.");

} catch (Exception e) {
ControlledVocabularyValue naValue = new ControlledVocabularyValue();
naValue.setStrValue(DatasetField.NA_VALUE);
datasetFieldService.save(naValue);
return okResponse("NA value created.");
}
}

Expand Down

0 comments on commit c391096

Please sign in to comment.