@Override public Response reindex(String vocabularyId, String url) { // Check permissions, the user must have admin rights on the entire wiki if (!this.userIsAdmin()) { return Response.status(Response.Status.FORBIDDEN).build(); } Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { return Response.status(Response.Status.NOT_FOUND).build(); } Response result; try { int reindexStatus = vocabulary.reindex(url); if (reindexStatus == 0) { result = Response.ok().build(); } else if (reindexStatus == 1) { result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } else { result = Response.status(Response.Status.BAD_REQUEST).build(); } } catch (UnsupportedOperationException e) { result = Response.status(Response.Status.SERVICE_UNAVAILABLE).build(); } return result; }
int reindexStatus = vocabulary.reindex(url);