diff --git a/AH MAM Migration/pom.xml b/AH MAM Migration/pom.xml index 7e1e67b..64cfc7c 100644 --- a/AH MAM Migration/pom.xml +++ b/AH MAM Migration/pom.xml @@ -1,19 +1,52 @@ - - 4.0.0 - AH-MAM-Migration - AH-MAM-Migration - 0.0.1-SNAPSHOT - - src - - - maven-compiler-plugin - 3.6.1 - - 1.8 - 1.8 - - - - + + 4.0.0 + AH-MAM-Migration + AH-MAM-Migration + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 1.5.6.RELEASE + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework + spring-web + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.hateoas + spring-hateoas + 0.23.0.RELEASE + + + + + src + + + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/AH MAM Migration/src/com/bayer/edam/migration/Application.java b/AH MAM Migration/src/com/bayer/edam/migration/Application.java new file mode 100644 index 0000000..cf8b218 --- /dev/null +++ b/AH MAM Migration/src/com/bayer/edam/migration/Application.java @@ -0,0 +1,31 @@ +package com.bayer.edam.migration; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.hateoas.MediaTypes; +import org.springframework.hateoas.client.Traverson; + +public class Application { + + private static final Logger log = LoggerFactory.getLogger(Application.class); + + public static void main(String args[]) { + Map parameters = new HashMap<>(); + parameters.put("user", 27); + + Traverson traverson; + try { + traverson = new Traverson(new URI("http://localhost:8080/api/"), MediaTypes.HAL_JSON); + String name = traverson.follow("movies", "movie", "actor").withTemplateParameters(parameters).toObject("$.name"); + + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/AH MAM Migration/src/hello/Application.java b/AH MAM Migration/src/hello/Application.java new file mode 100644 index 0000000..3a7f3af --- /dev/null +++ b/AH MAM Migration/src/hello/Application.java @@ -0,0 +1,18 @@ +package hello; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.client.RestTemplate; + +public class Application { + + private static final Logger log = LoggerFactory.getLogger(Application.class); + + public static void main(String args[]) { + RestTemplate restTemplate = new RestTemplate(); + Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); + restTemplate. + log.info(quote.toString()); + } + +} \ No newline at end of file diff --git a/AH MAM Migration/src/hello/Quote.java b/AH MAM Migration/src/hello/Quote.java new file mode 100644 index 0000000..70cd29c --- /dev/null +++ b/AH MAM Migration/src/hello/Quote.java @@ -0,0 +1,34 @@ +package hello; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Quote { + + private String type; + private Value value; + + public Quote() { + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Value getValue() { + return value; + } + + public void setValue(Value value) { + this.value = value; + } + + @Override + public String toString() { + return "Quote{" + "type='" + type + '\'' + ", value=" + value + '}'; + } +} \ No newline at end of file diff --git a/AH MAM Migration/src/hello/Value.java b/AH MAM Migration/src/hello/Value.java new file mode 100644 index 0000000..cf00e0d --- /dev/null +++ b/AH MAM Migration/src/hello/Value.java @@ -0,0 +1,34 @@ +package hello; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class Value { + + private Long id; + private String quote; + + public Value() { + } + + public Long getId() { + return this.id; + } + + public String getQuote() { + return this.quote; + } + + public void setId(Long id) { + this.id = id; + } + + public void setQuote(String quote) { + this.quote = quote; + } + + @Override + public String toString() { + return "Value{" + "id=" + id + ", quote='" + quote + '\'' + '}'; + } +} \ No newline at end of file