Cambios para notificacion
This commit is contained in:
commit
6f669ebb76
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<libraries xmlns="http://www.netbeans.org/ns/cdnjs-libraries/1"/>
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.8-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_mappings>/less:/css</org-netbeans-modules-css-prep.less_2e_mappings>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_enabled>false</org-netbeans-modules-css-prep.less_2e_enabled>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_enabled>false</org-netbeans-modules-css-prep.sass_2e_enabled>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_compiler_2e_options/>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings>
|
||||||
|
<org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>js/libs</org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<actions>
|
||||||
|
<action>
|
||||||
|
<actionName>run</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.clientUrlPart>werp-services</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<actionName>debug</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.clientUrlPart>werp-services</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<actionName>profile</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.profilemode>true</netbeans.deploy.profilemode>
|
||||||
|
<netbeans.deploy.clientUrlPart>werp-services</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.qsoft</groupId>
|
||||||
|
<artifactId>werp-services</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
<name>werp-services</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
|
<artifactId>jersey-media-multipart</artifactId>
|
||||||
|
<version>2.30</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<version>5.3.0.Final</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qsoft.util</groupId>
|
||||||
|
<artifactId>qsoft-util</artifactId>
|
||||||
|
<version>1.1.1-SNAPSHOT</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qsoft</groupId>
|
||||||
|
<artifactId>werp-domain</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-web-api</artifactId>
|
||||||
|
<version>7.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
<version>2.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.10.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
<compilerArguments>
|
||||||
|
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||||
|
<silent>true</silent>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-endorsed-api</artifactId>
|
||||||
|
<version>7.0</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.filter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Priority;
|
||||||
|
import javax.ws.rs.Priorities;
|
||||||
|
import javax.ws.rs.container.ContainerRequestContext;
|
||||||
|
import javax.ws.rs.container.ContainerResponseContext;
|
||||||
|
import javax.ws.rs.container.ContainerResponseFilter;
|
||||||
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See http://www.w3.org/TR/cors/
|
||||||
|
*
|
||||||
|
* @author airhacks.com
|
||||||
|
*/
|
||||||
|
@Provider
|
||||||
|
@Priority(Priorities.HEADER_DECORATOR)
|
||||||
|
public class CorsFilter implements ContainerResponseFilter {
|
||||||
|
|
||||||
|
public static final String ALLOWED_METHODS = "GET, POST, PUT, DELETE, OPTIONS, HEAD";
|
||||||
|
public final static int MAX_AGE = 42 * 60 * 60;
|
||||||
|
public final static String DEFAULT_ALLOWED_HEADERS = "origin,accept,content-type";
|
||||||
|
public final static String DEFAULT_EXPOSED_HEADERS = "location,info";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
|
||||||
|
final MultivaluedMap<String, Object> headers = responseContext.getHeaders();
|
||||||
|
headers.add("Access-Control-Allow-Origin", "*");
|
||||||
|
headers.add("Access-Control-Allow-Headers", getRequestedAllowedHeaders(requestContext));
|
||||||
|
headers.add("Access-Control-Expose-Headers", getRequestedExposedHeaders(requestContext));
|
||||||
|
headers.add("Access-Control-Allow-Credentials", "true");
|
||||||
|
headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
|
||||||
|
headers.add("Access-Control-Max-Age", MAX_AGE);
|
||||||
|
headers.add("x-responded-by", "cors-response-filter");
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestedAllowedHeaders(ContainerRequestContext responseContext) {
|
||||||
|
List<String> headers = responseContext.getHeaders().get("Access-Control-Allow-Headers");
|
||||||
|
return createHeaderList(headers, DEFAULT_ALLOWED_HEADERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestedExposedHeaders(ContainerRequestContext responseContext) {
|
||||||
|
List<String> headers = responseContext.getHeaders().get("Access-Control-Expose-Headers");
|
||||||
|
return createHeaderList(headers, DEFAULT_EXPOSED_HEADERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
String createHeaderList(List<String> headers, String defaultHeaders) {
|
||||||
|
if (headers == null || headers.isEmpty()) {
|
||||||
|
return defaultHeaders;
|
||||||
|
}
|
||||||
|
StringBuilder retVal = new StringBuilder();
|
||||||
|
for (int i = 0; i < headers.size(); i++) {
|
||||||
|
String header = (String) headers.get(i);
|
||||||
|
retVal.append(header);
|
||||||
|
retVal.append(',');
|
||||||
|
}
|
||||||
|
retVal.append(defaultHeaders);
|
||||||
|
return retVal.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.rest;
|
||||||
|
|
||||||
|
import com.qsoft.util.constantes.CodigoRespuesta;
|
||||||
|
import com.qsoft.util.constantes.ErrorTipo;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import com.qsoft.erp.constantes.DominioConstantes;
|
||||||
|
import com.qsoft.erp.constantes.EntidadEnum;
|
||||||
|
import com.qsoft.erp.dominio.AccionGenerica;
|
||||||
|
import com.qsoft.erp.dominio.exception.DominioExcepcion;
|
||||||
|
import com.qsoft.wmp.services.util.ServiceUtil;
|
||||||
|
import com.qsoft.wmp.services.xsd.EntradaAccion;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaAccion;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REST Web Service
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
@Path("accion")
|
||||||
|
public class AccionResource {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AccionGenerica accion;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void postConstructor() {
|
||||||
|
System.out.println("POST CONTRUCTOR " + accion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return an instance of java.lang.String
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaAccion getJson() {
|
||||||
|
SalidaAccion salida = ServiceUtil.crearSalidaAccionError(CodigoRespuesta.CODIGO_ERROR_GENERICO,
|
||||||
|
"Acción no soportada por favor ejecute la consulta via POST");
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PUT method for updating or creating an instance of ConsultaResource
|
||||||
|
*
|
||||||
|
* @param entrada
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaAccion postJson(EntradaAccion entrada) {
|
||||||
|
SalidaAccion salida = null;
|
||||||
|
if (entrada == null) {
|
||||||
|
salida = ServiceUtil.crearSalidaAccionError(ErrorTipo.WARNING, CodigoRespuesta.CODIGO_IN_NULO, "La entrada no puede ser nula");
|
||||||
|
} else {
|
||||||
|
EntidadEnum entidad = Enum.valueOf(EntidadEnum.class, entrada.getBodyIn().getEntidad());
|
||||||
|
if (entidad == null) {
|
||||||
|
salida = ServiceUtil.crearSalidaAccionError(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No se puede identificar la entidad a la cual se desea acceder");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
salida = ejecutarAccion(entrada, entidad);
|
||||||
|
} catch (DominioExcepcion ex) {
|
||||||
|
salida = ServiceUtil.crearSalidaAccionError(ex.getTipo(), ex.getCodigo(), ex.getMensaje());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.out.println("============ ERROR NO CONTROLADO ==============");
|
||||||
|
ex.printStackTrace(System.err);
|
||||||
|
String msg = getCauses(ex, new StringBuilder());
|
||||||
|
if (msg.contains("Duplicate entry")) {
|
||||||
|
salida = ServiceUtil.crearSalidaAccionError(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GUARDA_BDD,
|
||||||
|
"Error el registro " + entrada.getBodyIn().getEntidad() + " ya existe en la Base de datos");
|
||||||
|
} else {
|
||||||
|
salida = ServiceUtil.crearSalidaAccionError(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_ERROR_GENERICO, "ERROR NO CONTROLADO: " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param e
|
||||||
|
* @param build
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getCauses(Throwable e, StringBuilder build) {
|
||||||
|
build.append("\n").append(e.toString());
|
||||||
|
for (Throwable t : e.getSuppressed()) {
|
||||||
|
System.out.println("SUPRESS =====> " + t);
|
||||||
|
build.append("\n").append(t.toString());
|
||||||
|
getCauses(t, build);
|
||||||
|
}
|
||||||
|
System.out.println("CAUSE =====> " + e);
|
||||||
|
if (e.getCause() != null) {
|
||||||
|
getCauses(e.getCause(), build);
|
||||||
|
}
|
||||||
|
return build.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ejecuta la accion
|
||||||
|
*
|
||||||
|
* @param entrada
|
||||||
|
* @param entidad
|
||||||
|
* @return
|
||||||
|
* @throws DominioExcepcion
|
||||||
|
*/
|
||||||
|
public SalidaAccion ejecutarAccion(EntradaAccion entrada, EntidadEnum entidad) throws DominioExcepcion {
|
||||||
|
List<Object> resultado = accion.accionGenerica(entrada.getHeaderIn(), entidad, entrada.getBodyIn().getEntidades(), entrada.getBodyIn().getTipoAccion());
|
||||||
|
String msg = "A continuacion se muestra el resultado de la accion.";
|
||||||
|
HeaderMS header = entrada.getHeaderIn();
|
||||||
|
header.setFechaHora(DominioConstantes.getDateTime());
|
||||||
|
SalidaAccion salida = ServiceUtil.crearSalidaAccionOk(header, msg, resultado);
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.rest;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.ws.rs.core.Application;
|
||||||
|
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
@javax.ws.rs.ApplicationPath("servicios")
|
||||||
|
public class ApplicationConfig extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Class<?>> getClasses() {
|
||||||
|
Set<Class<?>> resources = new java.util.HashSet<>();
|
||||||
|
resources.add(MultiPartFeature.class);
|
||||||
|
addRestResourceClasses(resources);
|
||||||
|
return resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not modify addRestResourceClasses() method. It is automatically populated with all resources defined in the project. If required, comment
|
||||||
|
* out calling this method in getClasses().
|
||||||
|
*/
|
||||||
|
private void addRestResourceClasses(Set<Class<?>> resources) {
|
||||||
|
resources.add(com.qsoft.wmp.filter.CorsFilter.class);
|
||||||
|
resources.add(com.qsoft.wmp.services.rest.AccionResource.class);
|
||||||
|
resources.add(com.qsoft.wmp.services.rest.ConsultaResource.class);
|
||||||
|
resources.add(com.qsoft.wmp.services.rest.MultipartResource.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.rest;
|
||||||
|
|
||||||
|
import com.qsoft.util.constantes.CodigoRespuesta;
|
||||||
|
import com.qsoft.util.constantes.ErrorTipo;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import com.qsoft.erp.constantes.DominioConstantes;
|
||||||
|
import com.qsoft.erp.dominio.ConsultaGenerica;
|
||||||
|
import com.qsoft.erp.dominio.exception.DominioExcepcion;
|
||||||
|
import com.qsoft.wmp.services.util.ServiceUtil;
|
||||||
|
import com.qsoft.wmp.services.xsd.EntradaConsulta;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaConsulta;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REST Web Service
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
@Path("consulta")
|
||||||
|
public class ConsultaResource {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConsultaGenerica consulta;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void postConstructor() {
|
||||||
|
System.out.println("======> POST CONTRUCTOR " + consulta);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return an instance of java.lang.String
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaConsulta getJson() {
|
||||||
|
SalidaConsulta salida = ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_ERROR_GENERICO,
|
||||||
|
"Acción no soportada por favor ejecute la consulta via POST");
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PUT method for updating or creating an instance of ConsultaResource
|
||||||
|
*
|
||||||
|
* @param entrada
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaConsulta postJson(EntradaConsulta entrada) {
|
||||||
|
SalidaConsulta salida = null;
|
||||||
|
if (entrada == null) {
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaError(ErrorTipo.WARNING, CodigoRespuesta.CODIGO_IN_NULO, "La entrada no puede ser nula");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
List resultado = null;
|
||||||
|
resultado = consulta.consultaGenerica(entrada.getHeaderIn(), entrada.getBodyIn().getEntidad(),
|
||||||
|
entrada.getBodyIn().getParametros(), entrada.getBodyIn().getMaximoRegistros(), entrada.getBodyIn().getTipoConsulta());
|
||||||
|
|
||||||
|
HeaderMS header = entrada.getHeaderIn();
|
||||||
|
header.setFechaHora(DominioConstantes.getDateTime());
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaOk(header, entrada.getBodyIn().getEntidad(), resultado);
|
||||||
|
} catch (DominioExcepcion ex) {
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaError(ex.getTipo(), ex.getCodigo(), ex.getMensaje());
|
||||||
|
}catch (Exception ex) {
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_ERROR_GENERICO, ex.toString());
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.rest;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.qsoft.util.constantes.CodigoRespuesta;
|
||||||
|
import com.qsoft.util.constantes.ErrorTipo;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import com.qsoft.erp.constantes.DominioConstantes;
|
||||||
|
import com.qsoft.erp.constantes.EntidadEnum;
|
||||||
|
import com.qsoft.erp.dominio.MultipartService;
|
||||||
|
import com.qsoft.erp.dominio.exception.DominioExcepcion;
|
||||||
|
import com.qsoft.erp.dto.DocumentoDTO;
|
||||||
|
import com.qsoft.erp.dto.LiquidacionDTO;
|
||||||
|
import com.qsoft.wmp.services.util.ServiceUtil;
|
||||||
|
import com.qsoft.wmp.services.xsd.EntradaLiquidacion;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaConsulta;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.servlet.annotation.MultipartConfig;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||||
|
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REST Web Service
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
@Path("multipart")
|
||||||
|
@MultipartConfig(
|
||||||
|
maxFileSize = 838860800l, // 100Mb
|
||||||
|
fileSizeThreshold = 52428800, //512
|
||||||
|
maxRequestSize = 1024000 // 10Kb
|
||||||
|
)
|
||||||
|
public class MultipartResource {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private MultipartService multipart;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void postConstructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return an instance of java.lang.String
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaConsulta getJson() {
|
||||||
|
SalidaConsulta salida = ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_ERROR_GENERICO,
|
||||||
|
"Acción no soportada por favor ejecute la consulta via POST");
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public SalidaConsulta postFile(FormDataMultiPart input) {
|
||||||
|
SalidaConsulta salida = null;
|
||||||
|
EntradaLiquidacion entrada = null;
|
||||||
|
|
||||||
|
boolean estado = false;
|
||||||
|
if (input != null) {
|
||||||
|
List<Object> data = new ArrayList<>();
|
||||||
|
Map<String, List<FormDataBodyPart>> parts = input.getFields();
|
||||||
|
int i = 0;
|
||||||
|
try {
|
||||||
|
System.out.println("===========> RECIBE: " + parts);
|
||||||
|
for (List<FormDataBodyPart> p : parts.values()) {
|
||||||
|
FormDataBodyPart bp = p.get(0);
|
||||||
|
if (i == 0) {
|
||||||
|
entrada = getEntrada(bp);
|
||||||
|
if(entrada != null && entrada.getBodyIn().getParametros() != null &&
|
||||||
|
entrada.getBodyIn().getParametros().get("Liquidacion") != null &&
|
||||||
|
entrada.getBodyIn().getParametros().get("Liquidacion").getPolCodigo() != null &&
|
||||||
|
entrada.getBodyIn().getParametros().get("Liquidacion").getPolCodigo() == -1){
|
||||||
|
throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO,
|
||||||
|
"No existe una poliza activa no puede ejecutar este proceso");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
InputStream in = bp.getValueAs(InputStream.class);
|
||||||
|
try {
|
||||||
|
if (in != null && entrada != null && entrada.getBodyIn().getParametros() != null &&
|
||||||
|
entrada.getBodyIn().getParametros().get("Liquidacion") != null) {
|
||||||
|
DocumentoDTO doc = (DocumentoDTO) entrada.getBodyIn().getParametros().get("Liquidacion").getDocumentos().get(i - 1);
|
||||||
|
doc.setData(in.readAllBytes());
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println("ERROR CARGANDO ARCHIVO " + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (!validarEntrada(entrada)) {
|
||||||
|
throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO,
|
||||||
|
"Uno o mas documentos enviados son nulos por favor verifique la informacion");
|
||||||
|
}
|
||||||
|
EntidadEnum entidad = Enum.valueOf(EntidadEnum.class, entrada.getBodyIn().getEntidad());
|
||||||
|
data = this.multipart.multipartGenerico(entrada.getHeaderIn(), entidad,
|
||||||
|
entrada.getBodyIn().getParametros(), entrada.getBodyIn().getTipoConsulta());
|
||||||
|
HeaderMS header = entrada.getHeaderIn();
|
||||||
|
header.setFechaHora(DominioConstantes.getDateTime());
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaOk(header, entrada.getBodyIn().getEntidad(), data);
|
||||||
|
} catch (DominioExcepcion ex) {
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaError(ex.getCodigo(), ex.getMensaje());
|
||||||
|
ex.printStackTrace();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
salida = ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_ERROR_GENERICO, ex.toString());
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ServiceUtil.crearSalidaConsultaError(CodigoRespuesta.CODIGO_VALOR_NULO, "ERROR. La entrada no puede ser nula");
|
||||||
|
}
|
||||||
|
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param entrada
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean validarEntrada(EntradaLiquidacion entrada) {
|
||||||
|
boolean estado = true;
|
||||||
|
if (entrada == null || entrada.getBodyIn() == null || entrada.getBodyIn().getParametros() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (entrada.getBodyIn() != null && entrada.getBodyIn().getParametros() != null) {
|
||||||
|
for (LiquidacionDTO liq : entrada.getBodyIn().getParametros().values()) {
|
||||||
|
if (liq.getDocumentos() != null) {
|
||||||
|
for (DocumentoDTO doc : liq.getDocumentos()) {
|
||||||
|
if (doc == null || doc.getData() == null) {
|
||||||
|
estado = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crea la entrada a partir de la consulta del servicio
|
||||||
|
*
|
||||||
|
* @param bp
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public EntradaLiquidacion getEntrada(FormDataBodyPart bp) throws DominioExcepcion {
|
||||||
|
EntradaLiquidacion entrada = null;
|
||||||
|
InputStream in = bp.getValueAs(InputStream.class);
|
||||||
|
if (in != null) {
|
||||||
|
try {
|
||||||
|
String json = new String(in.readAllBytes());
|
||||||
|
ObjectMapper maper = new ObjectMapper();
|
||||||
|
maper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
|
||||||
|
entrada = maper.readValue(json, EntradaLiquidacion.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new DominioExcepcion(ErrorTipo.ERROR, CodigoRespuesta.CODIGO_VALOR_NULO, "No es posible convertir el JSON " + ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("CREO ENTRADA... " + entrada);
|
||||||
|
return entrada;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.util;
|
||||||
|
|
||||||
|
import com.qsoft.util.constantes.CodigoRespuesta;
|
||||||
|
import com.qsoft.util.constantes.ErrorTipo;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaAccion;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaConsulta;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
public class ServiceUtil {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida
|
||||||
|
*
|
||||||
|
* @param codigo
|
||||||
|
* @param mensaje
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaConsulta crearSalidaConsultaError(CodigoRespuesta codigo, String mensaje) {
|
||||||
|
SalidaConsulta salida = new SalidaConsulta();
|
||||||
|
salida.getError().setCodigo(codigo.getCodigo());
|
||||||
|
salida.getError().setMensaje(mensaje);
|
||||||
|
salida.getError().setTipo(ErrorTipo.ERROR.name());
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida
|
||||||
|
*
|
||||||
|
* @param codigo
|
||||||
|
* @param mensaje
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaAccion crearSalidaAccionError(CodigoRespuesta codigo, String mensaje) {
|
||||||
|
SalidaAccion salida = new SalidaAccion();
|
||||||
|
salida.getError().setCodigo(codigo.getCodigo());
|
||||||
|
salida.getError().setMensaje(mensaje);
|
||||||
|
salida.getError().setTipo(ErrorTipo.ERROR.name());
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida
|
||||||
|
*
|
||||||
|
* @param error
|
||||||
|
* @param codigo
|
||||||
|
* @param mensaje
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaConsulta crearSalidaConsultaError(ErrorTipo error, CodigoRespuesta codigo, String mensaje) {
|
||||||
|
SalidaConsulta salida = new SalidaConsulta();
|
||||||
|
salida.getError().setCodigo(codigo.getCodigo());
|
||||||
|
salida.getError().setMensaje(mensaje);
|
||||||
|
salida.getError().setTipo(error.name());
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida
|
||||||
|
*
|
||||||
|
* @param error
|
||||||
|
* @param codigo
|
||||||
|
* @param mensaje
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaAccion crearSalidaAccionError(ErrorTipo error, CodigoRespuesta codigo, String mensaje) {
|
||||||
|
SalidaAccion salida = new SalidaAccion();
|
||||||
|
salida.getError().setCodigo(codigo.getCodigo());
|
||||||
|
salida.getError().setMensaje(mensaje);
|
||||||
|
salida.getError().setTipo(error.name());
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida ok
|
||||||
|
*
|
||||||
|
* @param header
|
||||||
|
* @param tipoSalida
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaConsulta crearSalidaConsultaOk(HeaderMS header, String tipoSalida, List data) {
|
||||||
|
SalidaConsulta salida = new SalidaConsulta();
|
||||||
|
salida.setHeaderOut(header);
|
||||||
|
salida.getError().setCodigo(CodigoRespuesta.CODIGO_OK.getCodigo());
|
||||||
|
salida.getError().setMensaje(CodigoRespuesta.CODIGO_OK.name());
|
||||||
|
salida.getError().setTipo(ErrorTipo.INFO.name());
|
||||||
|
salida.getBodyOut().setEntidad(tipoSalida);
|
||||||
|
salida.getBodyOut().setData(data);
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crear salida ok
|
||||||
|
*
|
||||||
|
* @param header
|
||||||
|
* @param estado
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SalidaAccion crearSalidaAccionOk(HeaderMS header, String estado, List<Object> data) {
|
||||||
|
SalidaAccion salida = new SalidaAccion();
|
||||||
|
salida.setHeaderOut(header);
|
||||||
|
salida.getError().setCodigo(CodigoRespuesta.CODIGO_OK.getCodigo());
|
||||||
|
salida.getError().setMensaje(CodigoRespuesta.CODIGO_OK.name());
|
||||||
|
salida.getError().setTipo(ErrorTipo.INFO.name());
|
||||||
|
salida.getBodyOut().setEstado(estado);
|
||||||
|
salida.getBodyOut().setResultados(data);
|
||||||
|
return salida;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public class BodyEntradaAccion {
|
||||||
|
|
||||||
|
private Integer tipoAccion;
|
||||||
|
private String entidad;
|
||||||
|
private List<Map<String, Object>> entidades;
|
||||||
|
|
||||||
|
public Integer getTipoAccion() {
|
||||||
|
return tipoAccion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoAccion(Integer tipoAccion) {
|
||||||
|
this.tipoAccion = tipoAccion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntidad() {
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntidad(String entidad) {
|
||||||
|
this.entidad = entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getEntidades() {
|
||||||
|
return entidades;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntidades(List<Map<String, Object>> entidades) {
|
||||||
|
this.entidades = entidades;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
public class BodyEntradaConsulta {
|
||||||
|
|
||||||
|
private Integer tipoConsulta;
|
||||||
|
private Integer maximoRegistros;
|
||||||
|
private Integer registroInicio;
|
||||||
|
private String entidad;
|
||||||
|
private Map<String, Object> parametros;
|
||||||
|
|
||||||
|
public Integer getTipoConsulta() {
|
||||||
|
return tipoConsulta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConsulta(Integer tipoConsulta) {
|
||||||
|
this.tipoConsulta = tipoConsulta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getParametros() {
|
||||||
|
return parametros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParametros(Map<String, Object> parametros) {
|
||||||
|
this.parametros = parametros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntidad() {
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntidad(String entidad) {
|
||||||
|
this.entidad = entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaximoRegistros() {
|
||||||
|
return maximoRegistros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximoRegistros(Integer maximoRegistros) {
|
||||||
|
this.maximoRegistros = maximoRegistros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRegistroInicio() {
|
||||||
|
return registroInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegistroInicio(Integer registroInicio) {
|
||||||
|
this.registroInicio = registroInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.qsoft.erp.dto.LiquidacionDTO;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
public class BodyEntradaLiquidacion {
|
||||||
|
|
||||||
|
private Integer tipoConsulta;
|
||||||
|
private Integer maximoRegistros;
|
||||||
|
private String entidad;
|
||||||
|
private Map<String, LiquidacionDTO> parametros;
|
||||||
|
|
||||||
|
public Integer getTipoConsulta() {
|
||||||
|
return tipoConsulta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConsulta(Integer tipoConsulta) {
|
||||||
|
this.tipoConsulta = tipoConsulta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, LiquidacionDTO> getParametros() {
|
||||||
|
return parametros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParametros(Map<String, LiquidacionDTO> parametros) {
|
||||||
|
this.parametros = parametros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntidad() {
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntidad(String entidad) {
|
||||||
|
this.entidad = entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaximoRegistros() {
|
||||||
|
return maximoRegistros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximoRegistros(Integer maximoRegistros) {
|
||||||
|
this.maximoRegistros = maximoRegistros;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
public class BodySalidaAccion {
|
||||||
|
|
||||||
|
private String estado;
|
||||||
|
|
||||||
|
private List<Object> resultados;
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object> getResultados() {
|
||||||
|
return resultados;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResultados(List<Object> resultados) {
|
||||||
|
this.resultados = resultados;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public class BodySalidaConsulta<T extends Serializable> {
|
||||||
|
|
||||||
|
private String entidad;
|
||||||
|
|
||||||
|
private List<T> data;
|
||||||
|
|
||||||
|
public String getEntidad() {
|
||||||
|
return entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntidad(String entidad) {
|
||||||
|
this.entidad = entidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<T> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* EntradaConsulta.java
|
||||||
|
* 15 de feb. de 2017
|
||||||
|
* Copyright 2017 TCS.
|
||||||
|
* Todos los derechos reservados.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b> Entrada del servicio web. </b>
|
||||||
|
*
|
||||||
|
* @author jaime Ruales
|
||||||
|
* @version $1.0$
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso({HeaderMS.class})
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class EntradaAccion implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8142263336233087792L;
|
||||||
|
|
||||||
|
@XmlElement(name = "headerIn")
|
||||||
|
@JsonAlias("headerIn")
|
||||||
|
private HeaderMS headerIn;
|
||||||
|
|
||||||
|
@XmlElement(name = "bodyIn")
|
||||||
|
@JsonAlias("bodyIn")
|
||||||
|
private BodyEntradaAccion bodyIn;
|
||||||
|
|
||||||
|
public EntradaAccion() {
|
||||||
|
this.headerIn = new HeaderMS();
|
||||||
|
this.bodyIn = new BodyEntradaAccion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo headerIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HeaderMS getHeaderIn() {
|
||||||
|
return headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo headerIn
|
||||||
|
*
|
||||||
|
* @param headerIn
|
||||||
|
*/
|
||||||
|
public void setHeaderIn(final HeaderMS headerIn) {
|
||||||
|
this.headerIn = headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo bodyIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BodyEntradaAccion getBodyIn() {
|
||||||
|
return bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo bodyIn
|
||||||
|
*
|
||||||
|
* @param bodyIn
|
||||||
|
*/
|
||||||
|
public void setBodyIn(final BodyEntradaAccion bodyIn) {
|
||||||
|
this.bodyIn = bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* EntradaConsulta.java
|
||||||
|
* 15 de feb. de 2017
|
||||||
|
* Copyright 2017 TCS.
|
||||||
|
* Todos los derechos reservados.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b> Entrada del servicio web. </b>
|
||||||
|
*
|
||||||
|
* @author jaime Ruales
|
||||||
|
* @version $1.0$
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso({HeaderMS.class})
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class EntradaConsulta implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8142263336233087792L;
|
||||||
|
|
||||||
|
@XmlElement(name = "headerIn")
|
||||||
|
@JsonAlias("headerIn")
|
||||||
|
private HeaderMS headerIn;
|
||||||
|
|
||||||
|
@XmlElement(name = "bodyIn")
|
||||||
|
@JsonAlias("bodyIn")
|
||||||
|
private BodyEntradaConsulta bodyIn;
|
||||||
|
|
||||||
|
public EntradaConsulta() {
|
||||||
|
this.headerIn = new HeaderMS();
|
||||||
|
this.bodyIn = new BodyEntradaConsulta();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo headerIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HeaderMS getHeaderIn() {
|
||||||
|
return headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo headerIn
|
||||||
|
*
|
||||||
|
* @param headerIn
|
||||||
|
*/
|
||||||
|
public void setHeaderIn(final HeaderMS headerIn) {
|
||||||
|
this.headerIn = headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo bodyIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BodyEntradaConsulta getBodyIn() {
|
||||||
|
return bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo bodyIn
|
||||||
|
*
|
||||||
|
* @param bodyIn
|
||||||
|
*/
|
||||||
|
public void setBodyIn(final BodyEntradaConsulta bodyIn) {
|
||||||
|
this.bodyIn = bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* EntradaConsulta.java
|
||||||
|
* 15 de feb. de 2017
|
||||||
|
* Copyright 2017 TCS.
|
||||||
|
* Todos los derechos reservados.
|
||||||
|
*/
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b> Entrada del servicio web. </b>
|
||||||
|
*
|
||||||
|
* @author jaime Ruales
|
||||||
|
* @version $1.0$
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso({HeaderMS.class})
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class EntradaLiquidacion implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8142263336233087792L;
|
||||||
|
|
||||||
|
@XmlElement(name = "headerIn")
|
||||||
|
@JsonAlias("headerIn")
|
||||||
|
private HeaderMS headerIn;
|
||||||
|
|
||||||
|
@XmlElement(name = "bodyIn")
|
||||||
|
@JsonAlias("bodyIn")
|
||||||
|
private BodyEntradaLiquidacion bodyIn;
|
||||||
|
|
||||||
|
public EntradaLiquidacion() {
|
||||||
|
this.headerIn = new HeaderMS();
|
||||||
|
this.bodyIn = new BodyEntradaLiquidacion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo headerIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HeaderMS getHeaderIn() {
|
||||||
|
return headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo headerIn
|
||||||
|
*
|
||||||
|
* @param headerIn
|
||||||
|
*/
|
||||||
|
public void setHeaderIn(final HeaderMS headerIn) {
|
||||||
|
this.headerIn = headerIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo bodyIn
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BodyEntradaLiquidacion getBodyIn() {
|
||||||
|
return bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo bodyIn
|
||||||
|
*
|
||||||
|
* @param bodyIn
|
||||||
|
*/
|
||||||
|
public void setBodyIn(final BodyEntradaLiquidacion bodyIn) {
|
||||||
|
this.bodyIn = bodyIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import com.qsoft.util.ms.pojo.ErrorMS;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b> Salida del Servicio Web. </b>
|
||||||
|
*
|
||||||
|
* @author Jaime Ruales.
|
||||||
|
* @version $1.0$
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso({HeaderMS.class, ErrorMS.class})
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SalidaAccion implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5403227918589158188L;
|
||||||
|
|
||||||
|
@XmlElement(name = "headerOut")
|
||||||
|
@JsonAlias("headerOut")
|
||||||
|
protected HeaderMS headerOut;
|
||||||
|
|
||||||
|
@XmlElement(name = "bodyOut")
|
||||||
|
@JsonAlias("bodyOut")
|
||||||
|
protected BodySalidaAccion bodyOut;
|
||||||
|
|
||||||
|
@XmlElement(name = "error")
|
||||||
|
protected ErrorMS error;
|
||||||
|
|
||||||
|
public SalidaAccion() {
|
||||||
|
this.error = new ErrorMS();
|
||||||
|
this.headerOut = new HeaderMS();
|
||||||
|
this.bodyOut = new BodySalidaAccion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo headerOut
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HeaderMS getHeaderOut() {
|
||||||
|
return headerOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo headerOut
|
||||||
|
*
|
||||||
|
* @param headerOut
|
||||||
|
*/
|
||||||
|
public void setHeaderOut(final HeaderMS headerOut) {
|
||||||
|
this.headerOut = headerOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo error
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ErrorMS getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo bodyOut
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BodySalidaAccion getBodyOut() {
|
||||||
|
return bodyOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo bodyOut
|
||||||
|
*
|
||||||
|
* @param bodyOut
|
||||||
|
*/
|
||||||
|
public void setBodyOut(final BodySalidaAccion bodyOut) {
|
||||||
|
this.bodyOut = bodyOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo error
|
||||||
|
*
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
public void setError(final ErrorMS error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.qsoft.wmp.services.xsd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import com.qsoft.util.ms.pojo.ErrorMS;
|
||||||
|
import com.qsoft.util.ms.pojo.HeaderMS;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b> Salida del Servicio Web. </b>
|
||||||
|
*
|
||||||
|
* @author Jaime Ruales.
|
||||||
|
* @version $1.0$
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso({HeaderMS.class, ErrorMS.class})
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SalidaConsulta implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5403227918589158188L;
|
||||||
|
|
||||||
|
@XmlElement(name = "headerOut")
|
||||||
|
@JsonAlias("headerOut")
|
||||||
|
protected HeaderMS headerOut;
|
||||||
|
|
||||||
|
@XmlElement(name = "bodyOut")
|
||||||
|
@JsonAlias("bodyOut")
|
||||||
|
protected BodySalidaConsulta bodyOut;
|
||||||
|
|
||||||
|
@XmlElement(name = "error")
|
||||||
|
protected ErrorMS error;
|
||||||
|
|
||||||
|
public SalidaConsulta() {
|
||||||
|
this.error = new ErrorMS();
|
||||||
|
this.headerOut = new HeaderMS();
|
||||||
|
this.bodyOut = new BodySalidaConsulta();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo headerOut
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HeaderMS getHeaderOut() {
|
||||||
|
return headerOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo headerOut
|
||||||
|
*
|
||||||
|
* @param headerOut
|
||||||
|
*/
|
||||||
|
public void setHeaderOut(final HeaderMS headerOut) {
|
||||||
|
this.headerOut = headerOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo error
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ErrorMS getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accesor del campo bodyOut
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BodySalidaConsulta getBodyOut() {
|
||||||
|
return bodyOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo bodyOut
|
||||||
|
*
|
||||||
|
* @param bodyOut
|
||||||
|
*/
|
||||||
|
public void setBodyOut(final BodySalidaConsulta bodyOut) {
|
||||||
|
this.bodyOut = bodyOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modificador del campo error
|
||||||
|
*
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
public void setError(final ErrorMS error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Context path="/erp-services"/>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jboss-deployment-structure>
|
||||||
|
<deployment>
|
||||||
|
<dependencies>
|
||||||
|
<module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import"/>
|
||||||
|
</dependencies>
|
||||||
|
</deployment>
|
||||||
|
</jboss-deployment-structure>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jboss-web version="8.0" xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_8_0.xsd">
|
||||||
|
<context-root>/erp-services</context-root>
|
||||||
|
</jboss-web>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
|
||||||
|
|
||||||
|
</web-app>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Start Page</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Hello World!</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"headerIn": {
|
||||||
|
"dispositivo": "WeLaptop",
|
||||||
|
"canal": null,
|
||||||
|
"medio": null,
|
||||||
|
"aplicacion": "WeMedicalProV1.0",
|
||||||
|
"tipoTransaccion": "0101102",
|
||||||
|
"usuario": "james",
|
||||||
|
"uuid": "a1290bc2516a607bb39a913251fb94cc5dcb7c4f9f6e0038a685758e014a45f1",
|
||||||
|
"fechaHora": null,
|
||||||
|
"idioma": null,
|
||||||
|
"empresa": null,
|
||||||
|
"geolocalizacion": null
|
||||||
|
},
|
||||||
|
"bodyIn": {
|
||||||
|
"tipoAccion": 2,
|
||||||
|
"entidad": "DetalleLiquidacion",
|
||||||
|
"entidades": [
|
||||||
|
{
|
||||||
|
"delCodigo": 104,
|
||||||
|
"delValorRegistrado": 60,
|
||||||
|
"delValorObjetado": 124.16,
|
||||||
|
"detalle": [
|
||||||
|
{
|
||||||
|
"talCodigo": 1,
|
||||||
|
"talValorObjetado": 35.25,
|
||||||
|
"talEstado": 1,
|
||||||
|
"tarCodigo": 6172
|
||||||
|
}, {
|
||||||
|
"talCodigo": 2,
|
||||||
|
"talValorObjetado": 38.22,
|
||||||
|
"talEstado": 1,
|
||||||
|
"tarCodigo": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"talCodigo": 3,
|
||||||
|
"talValorObjetado": 50.69,
|
||||||
|
"talEstado": 1,
|
||||||
|
"tarCodigo": 6663
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
"headerIn": {
|
||||||
|
"dispositivo": "james-laptop001",
|
||||||
|
"canal": null,
|
||||||
|
"medio": null,
|
||||||
|
"aplicacion": "WeERPV1.0",
|
||||||
|
"tipoTransaccion": "0101151",
|
||||||
|
"usuario": "james",
|
||||||
|
"uuid": "2e25aed60f2d4c63e33864a638b906f2df987a9b37ce3f8dafde7b565b2a6c41",
|
||||||
|
"fechaHora": "20/05/2020 23:55:36",
|
||||||
|
"idioma": "ES",
|
||||||
|
"empresa": "Enigma-Lovers",
|
||||||
|
"geolocalizacion": null
|
||||||
|
},
|
||||||
|
"bodyIn": {
|
||||||
|
"tipoAccion": 1,
|
||||||
|
"entidad": "FacturaCompra",
|
||||||
|
"entidades": [
|
||||||
|
{
|
||||||
|
"facEstablecimiento": "001",
|
||||||
|
"facPtoEmision": "001",
|
||||||
|
"facSecuencial": "00000001",
|
||||||
|
"facClaveAcceso": null,
|
||||||
|
"facAutorizacion": null,
|
||||||
|
"facTotalDescuentos": null,
|
||||||
|
"facTotalImpuestos": null,
|
||||||
|
"facTotalOtros": null,
|
||||||
|
"facImporte": null,
|
||||||
|
"facTotal": null,
|
||||||
|
"facAdelanto": null,
|
||||||
|
"facPendiente": null,
|
||||||
|
"facReferencia": null,
|
||||||
|
"facPropina": null,
|
||||||
|
"facFechaRegistro": null,
|
||||||
|
"facFechaAutorizacion": null,
|
||||||
|
"facDescripcion": null,
|
||||||
|
"facObservacion": null,
|
||||||
|
"facDetalle": null,
|
||||||
|
"facDinamico": "CUANDO SE ADQUIERE SERVICIOS O CONSUMIBLES QUE NO GENERAN ENTRADA SE AGREGA AQUI",
|
||||||
|
"ejeCodigo": null,
|
||||||
|
"empCodigo": null,
|
||||||
|
"proCodigo": 1,
|
||||||
|
"detEstado": null,
|
||||||
|
"detTipo": null,
|
||||||
|
"usuCodigo": null,
|
||||||
|
"detalle": [
|
||||||
|
{
|
||||||
|
"denCantidad": 2.0,
|
||||||
|
"denPrecioCompra": 89.3,
|
||||||
|
"denFecProduccion": 1590073789081,
|
||||||
|
"denFecCaducidad": 1590073789081,
|
||||||
|
"artCodigo": 1,
|
||||||
|
"bodCodigo": 1,
|
||||||
|
"detUnidad": null,
|
||||||
|
"entCodigo": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.qsoft.test;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.qsoft.erp.constantes.DominioConstantes;
|
||||||
|
import com.qsoft.erp.constantes.EntidadEnum;
|
||||||
|
import com.qsoft.erp.dominio.AccionGenerica;
|
||||||
|
import com.qsoft.erp.dto.DocumentoDTO;
|
||||||
|
import com.qsoft.erp.dto.EstadoLiquidacionDTO;
|
||||||
|
import com.qsoft.erp.dto.LiquidacionDTO;
|
||||||
|
import com.qsoft.erp.dto.PolizaDTO;
|
||||||
|
import com.qsoft.wmp.services.rest.AccionResource;
|
||||||
|
import com.qsoft.wmp.services.rest.ConsultaResource;
|
||||||
|
import com.qsoft.wmp.services.xsd.EntradaAccion;
|
||||||
|
import com.qsoft.wmp.services.xsd.EntradaConsulta;
|
||||||
|
import com.qsoft.wmp.services.xsd.SalidaConsulta;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author james
|
||||||
|
*/
|
||||||
|
public class Tester {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
System.out.println("TEST " + DominioConstantes.getDateTime());
|
||||||
|
testAccionService();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testConsultaService() throws IOException {
|
||||||
|
ObjectMapper maper = new ObjectMapper();
|
||||||
|
EntradaConsulta entrada = new EntradaConsulta();
|
||||||
|
entrada.getBodyIn().setTipoConsulta(1);
|
||||||
|
entrada.getBodyIn().setEntidad(EntidadEnum.Liquidacion.name());
|
||||||
|
|
||||||
|
LiquidacionDTO ld = new LiquidacionDTO();
|
||||||
|
List<DocumentoDTO> documentos = new ArrayList<>();
|
||||||
|
List<EstadoLiquidacionDTO> estados = new ArrayList<>();
|
||||||
|
documentos.add(new DocumentoDTO());
|
||||||
|
estados.add(new EstadoLiquidacionDTO());
|
||||||
|
ld.setDocumentos(documentos);
|
||||||
|
ld.setEstados(estados);
|
||||||
|
Map<String, Object> parametros = new HashMap<>();
|
||||||
|
parametros.put(EntidadEnum.Liquidacion.name(), ld);
|
||||||
|
|
||||||
|
entrada.getBodyIn().setParametros(parametros);
|
||||||
|
String s = maper.writeValueAsString(entrada);
|
||||||
|
System.out.println("JSON=> " + s);
|
||||||
|
|
||||||
|
ConsultaResource cr = new ConsultaResource();
|
||||||
|
System.out.println("POSTING....");
|
||||||
|
SalidaConsulta salida = cr.postJson(entrada);
|
||||||
|
System.out.println("Funciono???/ " + salida);
|
||||||
|
s = maper.writeValueAsString(salida);
|
||||||
|
System.out.println("JSON=> " + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testAccionService() throws IOException {
|
||||||
|
ObjectMapper maper = new ObjectMapper();
|
||||||
|
EntradaAccion entrada = new EntradaAccion();
|
||||||
|
entrada.getBodyIn().setTipoAccion(AccionGenerica.GUARDA);
|
||||||
|
entrada.getBodyIn().setEntidad(EntidadEnum.DetalleLiquidacion.name());
|
||||||
|
List<Map<String, Object>> entidades = new ArrayList<>();
|
||||||
|
//TODO: agregar entidades
|
||||||
|
entrada.getBodyIn().setEntidades(entidades);
|
||||||
|
|
||||||
|
String s = maper.writeValueAsString(entrada);
|
||||||
|
System.out.println("JSON=> " + s);
|
||||||
|
AccionResource ar = new AccionResource();
|
||||||
|
System.out.println("POSTING....");
|
||||||
|
List<PolizaDTO> data = new ArrayList<>();
|
||||||
|
PolizaDTO pol = new PolizaDTO();
|
||||||
|
pol.setDetTipoIdentificacion(3);
|
||||||
|
pol.setPerCedulaTitular("1715060073");
|
||||||
|
pol.setDetModalidad(25);
|
||||||
|
pol.setDetPeriodicidad(17200);
|
||||||
|
pol.setDetFormaPago(23516);
|
||||||
|
pol.setDetIfi(17205);
|
||||||
|
pol.setDetSucursalIfi(23484);
|
||||||
|
pol.setDetPromocion(23584);
|
||||||
|
pol.setDetTipoCuenta(17187);
|
||||||
|
pol.setEmpCodigo(2);
|
||||||
|
pol.setCedulaDebito("1715060012");
|
||||||
|
pol.setCuentaDebito("123456789");
|
||||||
|
pol.setPolBroker("Asesor CPN");
|
||||||
|
|
||||||
|
data.add(pol);
|
||||||
|
|
||||||
|
s = maper.writeValueAsString(data);
|
||||||
|
System.out.println("JSON=> " + s);
|
||||||
|
// SalidaAccion salida = ar.postJson(entrada);
|
||||||
|
// System.out.println("Funciono??? " + salida);
|
||||||
|
// s = maper.writeValueAsString(salida);
|
||||||
|
// System.out.println("JSON=> " + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"headerIn": {
|
||||||
|
"dispositivo": "WeLaptop",
|
||||||
|
"canal": null,
|
||||||
|
"medio": null,
|
||||||
|
"aplicacion": "WeMedicalProV1.0",
|
||||||
|
"tipoTransaccion": "0101000",
|
||||||
|
"usuario": "james",
|
||||||
|
"uuid": "7cbec0b8ec642ddbd7b9b24a35e39b70938d",
|
||||||
|
"fechaHora": null,
|
||||||
|
"idioma": null,
|
||||||
|
"empresa": null,
|
||||||
|
"geolocalizacion": null
|
||||||
|
},
|
||||||
|
"bodyIn": {
|
||||||
|
"maximoRegistros": 10,
|
||||||
|
"tipoConsulta": 1,
|
||||||
|
"entidad": "Empresa",
|
||||||
|
"parametros": {
|
||||||
|
"tipoNemonico": "COMERC"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue