Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
#86: moved TemplateResponse to LegacyConversationWebservice; other mi…
Browse files Browse the repository at this point in the history
…nor changes
  • Loading branch information
westei committed Nov 30, 2017
1 parent 9d97a84 commit 8df3a2f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 68 deletions.
Expand Up @@ -530,7 +530,6 @@ public ResponseEntity<Template> getTemplate(
// TODO: check Authentication / clientId
final Client client = null;

// TODO(westei): Check if conversation needs to be re-analyzed/processed
final Conversation conversation = conversationService.getConversation(conversationId);
if (conversation == null) {
return ResponseEntity.notFound().build();
Expand Down Expand Up @@ -583,9 +582,6 @@ public ResponseEntity<? extends SearchResult<? extends Result>> getResults(
return ResponseEntity.badRequest().build();
}

// TODO(westei): Check if conversation needs to be re-analyzed/processed


final List<Template> templates = getAnalysis(client, conversation).getTemplates();
final Template template;

Expand Down
Expand Up @@ -28,6 +28,8 @@
import io.redlink.smarti.webservice.pojo.QueryUpdate;
import io.redlink.smarti.webservice.pojo.TemplateResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
Expand All @@ -41,6 +43,8 @@
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

Expand Down Expand Up @@ -271,4 +275,42 @@ public ResponseEntity<?> complete(@PathVariable("id") ObjectId id) {
return ResponseEntity.ok(conversationService.completeConversation(conversation));
}
}

/**
*/
@ApiModel
public static class TemplateResponse {

@ApiModelProperty(value = "Tokens extracted")
private List<Token> tokens = new ArrayList<>();

@ApiModelProperty(value = "Templates for possible queries")
private List<Template> templates = new ArrayList<>();

public List<Token> getTokens() {
return tokens;
}

public void setTokens(List<Token> tokens) {
this.tokens = tokens;
}

public List<Template> getTemplates() {
return templates;
}

public void setTemplates(List<Template> templates) {
this.templates = templates;
}

public static TemplateResponse from(Conversation conversation) {
final TemplateResponse response = new TemplateResponse();

response.tokens = conversation.getTokens();
response.templates = conversation.getTemplates();


return response;
}
}
}

This file was deleted.

0 comments on commit 8df3a2f

Please sign in to comment.