diff --git b/.classpath a/.classpath new file mode 100644 index 0000000..e33b0e3 --- /dev/null +++ a/.classpath @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git b/.project a/.project new file mode 100644 index 0000000..281a955 --- /dev/null +++ a/.project @@ -0,0 +1,48 @@ + + + demo_itau + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git b/.settings/.jsdtscope a/.settings/.jsdtscope new file mode 100644 index 0000000..81672d4 --- /dev/null +++ a/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git b/.settings/org.eclipse.jdt.core.prefs a/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d0e943e --- /dev/null +++ a/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.5 diff --git b/.settings/org.eclipse.m2e.core.prefs a/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ a/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git b/.settings/org.eclipse.wst.common.component a/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..075f195 --- /dev/null +++ a/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git b/.settings/org.eclipse.wst.common.project.facet.core.xml a/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..ef27789 --- /dev/null +++ a/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git b/.settings/org.eclipse.wst.jsdt.ui.superType.container a/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ a/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git b/.settings/org.eclipse.wst.jsdt.ui.superType.name a/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ a/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git b/.settings/org.eclipse.wst.validation.prefs a/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ a/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git b/pom.xml a/pom.xml new file mode 100644 index 0000000..f2ac5e0 --- /dev/null +++ a/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + com.demo.roshka + demo_itau + 0.0.1-SNAPSHOT + war + DemoRshk + + + + org.springframework + spring-webmvc + 5.0.8.RELEASE + + + org.projectlombok + lombok + 1.18.10 + provided + + + com.fasterxml.jackson.core + jackson-databind + 2.7.4 + + + + \ No newline at end of file diff --git b/src/main/java/com/rshk/demo/AppConfiguration.java a/src/main/java/com/rshk/demo/AppConfiguration.java new file mode 100644 index 0000000..4d1795a --- /dev/null +++ a/src/main/java/com/rshk/demo/AppConfiguration.java @@ -0,0 +1,14 @@ +package com.rshk.demo; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +@Configuration +@EnableWebMvc +public class AppConfiguration { + + @Value(value = "variable") + private String variable; + +} diff --git b/src/main/java/com/rshk/demo/beans/Customer.java a/src/main/java/com/rshk/demo/beans/Customer.java new file mode 100644 index 0000000..80e802a --- /dev/null +++ a/src/main/java/com/rshk/demo/beans/Customer.java @@ -0,0 +1,26 @@ +package com.rshk.demo.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +public class Customer { + + @JsonProperty(value = "customer_id", required = true) + private int id; + + @JsonProperty(value = "customer_name", required = true) + private String name; + + @JsonProperty(value = "customer_address", required = true) + private String address; + + @JsonProperty(value = "customer_number", required = true) + private String phoneNumber; + +} diff --git b/src/main/java/com/rshk/demo/beans/CustomerGetRespData.java a/src/main/java/com/rshk/demo/beans/CustomerGetRespData.java new file mode 100644 index 0000000..cdbc52e --- /dev/null +++ a/src/main/java/com/rshk/demo/beans/CustomerGetRespData.java @@ -0,0 +1,17 @@ +package com.rshk.demo.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class CustomerGetRespData { + + @JsonProperty(value = "data") + private Customer data; + +} diff --git b/src/main/java/com/rshk/demo/beans/CustomerListData.java a/src/main/java/com/rshk/demo/beans/CustomerListData.java new file mode 100644 index 0000000..140995f --- /dev/null +++ a/src/main/java/com/rshk/demo/beans/CustomerListData.java @@ -0,0 +1,19 @@ +package com.rshk.demo.beans; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class CustomerListData { + + @JsonProperty(value = "data") + private List data; + +} diff --git b/src/main/java/com/rshk/demo/beans/Error.java a/src/main/java/com/rshk/demo/beans/Error.java new file mode 100644 index 0000000..57183f0 --- /dev/null +++ a/src/main/java/com/rshk/demo/beans/Error.java @@ -0,0 +1,17 @@ +package com.rshk.demo.beans; + +import lombok.AllArgsConstructor; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Error { + + private String code; + + private String message; + +} diff --git b/src/main/java/com/rshk/demo/controllers/CustomerController.java a/src/main/java/com/rshk/demo/controllers/CustomerController.java new file mode 100644 index 0000000..f2ad3dc --- /dev/null +++ a/src/main/java/com/rshk/demo/controllers/CustomerController.java @@ -0,0 +1,59 @@ +package com.rshk.demo.controllers; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.rshk.demo.beans.Customer; +import com.rshk.demo.beans.CustomerGetRespData; +import com.rshk.demo.beans.CustomerListData; +import com.rshk.demo.services.CustomerService; + +@RestController +@RequestMapping("/customers") +public class CustomerController { + + @Autowired + private CustomerService customerService; + + @RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity getCustomerList() { + + try { + ResponseEntity response = null; + + List customerList = customerService.getCustomers(); + + return new ResponseEntity(new CustomerListData(customerList), HttpStatus.OK); + + } catch (Exception e) { + e.printStackTrace(); + return new ResponseEntity( + new com.rshk.demo.beans.Error("FTL_PF_1231", e.getMessage()), HttpStatus.UNPROCESSABLE_ENTITY); + } + + } + + @RequestMapping(value = "/{document}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity get(@PathVariable String id) { + try { + ResponseEntity response = null; + + Customer customer = customerService.get(id); + + return new ResponseEntity(new CustomerGetRespData(customer), HttpStatus.OK); + + }catch(Exception e) { + e.printStackTrace(); + return new ResponseEntity(new Error(), HttpStatus.UNPROCESSABLE_ENTITY); + } + } + +} diff --git b/src/main/java/com/rshk/demo/services/CustomerService.java a/src/main/java/com/rshk/demo/services/CustomerService.java new file mode 100644 index 0000000..2499de0 --- /dev/null +++ a/src/main/java/com/rshk/demo/services/CustomerService.java @@ -0,0 +1,15 @@ +package com.rshk.demo.services; + +import java.util.List; + +import com.rshk.demo.beans.Customer; + +public interface CustomerService { + + void insert(Customer customer); + + Customer get(String document); + + List getCustomers(); + +} diff --git b/src/main/java/com/rshk/demo/services/CustomerServiceImpl.java a/src/main/java/com/rshk/demo/services/CustomerServiceImpl.java new file mode 100644 index 0000000..54e512e --- /dev/null +++ a/src/main/java/com/rshk/demo/services/CustomerServiceImpl.java @@ -0,0 +1,27 @@ +package com.rshk.demo.services; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.rshk.demo.beans.Customer; + +@Service +public class CustomerServiceImpl implements CustomerService { + + public void insert(Customer customer) { + // TODO Auto-generated method stub + + } + + public Customer get(String document) { + // TODO Auto-generated method stub + return null; + } + + public List getCustomers() { + // TODO Auto-generated method stub + return null; + } + +} diff --git b/src/main/webapp/WEB-INF/web.xml a/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..35f72d4 --- /dev/null +++ a/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,12 @@ + + + demo_itau + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + \ No newline at end of file diff --git b/target/classes/com/rshk/demo/AppConfiguration.class a/target/classes/com/rshk/demo/AppConfiguration.class new file mode 100644 index 0000000..7300708 Binary files /dev/null and a/target/classes/com/rshk/demo/AppConfiguration.class differ diff --git b/target/classes/com/rshk/demo/beans/Customer.class a/target/classes/com/rshk/demo/beans/Customer.class new file mode 100644 index 0000000..fac201d Binary files /dev/null and a/target/classes/com/rshk/demo/beans/Customer.class differ diff --git b/target/classes/com/rshk/demo/beans/CustomerGetRespData.class a/target/classes/com/rshk/demo/beans/CustomerGetRespData.class new file mode 100644 index 0000000..4bd4048 Binary files /dev/null and a/target/classes/com/rshk/demo/beans/CustomerGetRespData.class differ diff --git b/target/classes/com/rshk/demo/beans/CustomerListData.class a/target/classes/com/rshk/demo/beans/CustomerListData.class new file mode 100644 index 0000000..c80cdac Binary files /dev/null and a/target/classes/com/rshk/demo/beans/CustomerListData.class differ diff --git b/target/classes/com/rshk/demo/beans/Error.class a/target/classes/com/rshk/demo/beans/Error.class new file mode 100644 index 0000000..d0b2c7c Binary files /dev/null and a/target/classes/com/rshk/demo/beans/Error.class differ diff --git b/target/classes/com/rshk/demo/controllers/CustomerController.class a/target/classes/com/rshk/demo/controllers/CustomerController.class new file mode 100644 index 0000000..fe655d0 Binary files /dev/null and a/target/classes/com/rshk/demo/controllers/CustomerController.class differ diff --git b/target/classes/com/rshk/demo/services/CustomerService.class a/target/classes/com/rshk/demo/services/CustomerService.class new file mode 100644 index 0000000..017b746 Binary files /dev/null and a/target/classes/com/rshk/demo/services/CustomerService.class differ diff --git b/target/classes/com/rshk/demo/services/CustomerServiceImpl.class a/target/classes/com/rshk/demo/services/CustomerServiceImpl.class new file mode 100644 index 0000000..fd84d92 Binary files /dev/null and a/target/classes/com/rshk/demo/services/CustomerServiceImpl.class differ diff --git b/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF a/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d3210d0 --- /dev/null +++ a/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: jorgecaceresflores +Build-Jdk: 1.8.0_232 +Created-By: Maven Integration for Eclipse + diff --git b/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.properties a/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.properties new file mode 100644 index 0000000..0bf01d0 --- /dev/null +++ a/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Tue Jan 14 21:44:08 PYST 2020 +version=0.0.1-SNAPSHOT +groupId=com.demo.roshka +m2e.projectName=demo_itau +m2e.projectLocation=/Users/jorgecaceresflores/Documents/workspace-sts-3.9.11.RELEASE/demo_itau +artifactId=demo_itau diff --git b/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.xml a/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.xml new file mode 100644 index 0000000..f2ac5e0 --- /dev/null +++ a/target/m2e-wtp/web-resources/META-INF/maven/com.demo.roshka/demo_itau/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + com.demo.roshka + demo_itau + 0.0.1-SNAPSHOT + war + DemoRshk + + + + org.springframework + spring-webmvc + 5.0.8.RELEASE + + + org.projectlombok + lombok + 1.18.10 + provided + + + com.fasterxml.jackson.core + jackson-databind + 2.7.4 + + + + \ No newline at end of file