Skip to content

Commit 4084869

Browse files
committed
Better replacements
1 parent fc9f7ad commit 4084869

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package ml.anon.annotation;
2+
3+
import ml.anon.model.anonymization.Label;
4+
import org.springframework.http.ResponseEntity;
5+
import org.springframework.web.client.RestTemplate;
6+
import org.springframework.web.util.UriUtils;
7+
8+
import java.io.UnsupportedEncodingException;
9+
import java.net.URI;
10+
11+
/**
12+
* Created by mirco on 13.06.17.
13+
*/
14+
public class ReplacementAccess {
15+
16+
private RestTemplate template = new RestTemplate();
17+
18+
public String generateReplacement(String original, Label label) throws UnsupportedEncodingException {
19+
String l = label == null ? "MISC" : label.toString();
20+
21+
StringBuilder builder = new StringBuilder("http://127.0.0.1:9001/replacement").append("?original=")
22+
.append(UriUtils.encode(original, "UTF-8")).append("&label=").append(l);
23+
String url = builder.toString();
24+
25+
ResponseEntity<String> repl = template.getForEntity(url, String.class);
26+
return repl.getBody();
27+
}
28+
}

src/main/java/ml/anon/annotation/ReplacementGenerator.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)