Commit b203864b authored by Walter Molina's avatar Walter Molina

update folder

parent 5689dfc3
Pipeline #373 canceled with stages

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
FROM java:openjdk-8-jdk-alpine
MAINTAINER schicoma@bytesw.com
USER root
#RUN yum -y install java-1.8.0-openjdk
RUN apk add --update curl && \
rm -rf /var/cache/apk/*
RUN export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
RUN export PATH=$JAVA_HOME/bin:$PATH
# VOLUME /tmp
RUN echo 'target/bytebot-service-1.0.1-SNAPSHOT.jar'
COPY 'target/bytebot-service-1.0.1-SNAPSHOT.jar' app.jar
# ENV JAVA_OPTS="-Xms512m -Xmx1024m"
EXPOSE 8080
EXPOSE 8443
EXPOSE 22
ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
FROM python:3.8-slim
USER root
COPY . .
RUN apt update && \
apt install -y nano curl awscli
RUN chmod +x entrypoint.sh
RUN mkdir /data
VOLUME [ "/data" ]
CMD ["sh","entrypoint.sh"]
\ No newline at end of file
pipeline {
agent any
parameters {
string(defaultValue: 'no', description: 'Ejecuta los procesos docker', name: 'include_docker')
}
environment {
IMAGE = readMavenPom().getArtifactId()
VERSION = readMavenPom().getVersion()
url = "http://192.168.27.148:5000"
tag_name = "192.168.27.148:5000"
imagename = "${tag_name}/bytesw/${IMAGE}"
credentials = "admin-docker-hub"
}
tools {
maven 'Maven'
jdk "jdk-11.0.1"
jdk "jdk8"
}
stages {
stage ('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}
stage('Build') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -B -DskipTests clean package'
}
}
}
stage('Test') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn test'
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
/* stage('Code Quality Check via SonarQube') {
steps {
withEnv(["JAVA_HOME=${tool 'jdk8'}", "PATH=${tool 'jdk8'}/bin:${env.PATH}"]) {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -DskipTests sonar:sonar \
-Dsonar.projectKey=bytebot-service_$BRANCH_NAME \
-Dsonar.projectName=bytebot-service_$BRANCH_NAME \
-Dsonar.sources=src/main/java/ \
-Dsonar.language=java \
-Dsonar.java.binaries=target/classes \
-Dsonar.junit.reportsPath=target/surefire-reports \
-Dsonar.jacoco.reportPaths=target/jacoco.exec \
-Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml \
-Dsonar.clover.reportPath=target/clover.xml \
-Dsonar.dynamicAnalysis=reuseReports \
-Dsonar.java.coveragePlugin=plugin \
-Dsonar.jacoco.reportMissing.force.zero=true \
-Dsonar.host.url=http://byteswpe-sonar.tbs.com:9000 \
-Dsonar.login=d09303420d51f36385b4613d29ee98978ca2ebe4'
}}
}
} */
stage('Deploy') {
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn -DskipTests deploy'
}
}
}
stage('Build Docker Image') {
when {
expression { params.include_docker == 'yes' }
}
steps {
withMaven(maven: 'Maven', mavenSettingsConfig: '2ea57b6f-d6f0-42bc-9770-f24d4170a439') {
sh 'mvn clean install -DskipTests -P docker'
}
}
}
stage('Deploy Image') {
when {
expression { params.include_docker == 'yes' }
}
steps{
script {
docker.withRegistry(url, credentials ) {
sh "docker push ${imagename}:${VERSION}"
sh "docker tag ${imagename}:${VERSION} ${imagename}:latest"
sh "docker push ${imagename}:latest"
}
}
}
}
stage('Remove Unused docker image') {
when {
expression { params.include_docker == 'yes' }
}
steps {
sh "docker rmi ${imagename}:latest"
sh "docker rmi ${imagename}:${VERSION}"
}
}
}
post {
always {
echo 'Confirmación de ejecución!'
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}",
to: '$DEFAULT_RECIPIENTS'
}
}
}
DROP TABLE IF EXISTS `PILO_ENTITY` CASCADE;
DROP TABLE IF EXISTS `TiposDeMotivo` CASCADE;
DROP TABLE IF EXISTS `XDF_ENTIDADES` CASCADE;
DROP TABLE IF EXISTS `Estados` CASCADE;
DROP TABLE IF EXISTS `Motivos` CASCADE;
CREATE TABLE PILO_ENTITY
(
`ENT_ID` BIGINT NOT NULL COMMENT 'Identificador único del tipo de la entidad, secuencial auto generado.',
`ENT_NAME` VARCHAR(50) NOT NULL COMMENT 'Nombre de la entidad.',
`ENT_DESC` VARCHAR(50) NOT NULL COMMENT 'Descripción de la entidad',
CONSTRAINT `PK_Entidades` PRIMARY KEY (`ENT_ID` ASC)
)
COMMENT='Catálogo de entidades del sistema'
;
CREATE TABLE `Estados`
(
`idEstado` BIGINT NOT NULL,
`idEntidad` BIGINT NULL,
`codEstado` BIGINT NULL,
`aliasEstado` VARCHAR(20) NULL,
`descEstado` VARCHAR(50) NULL,
CONSTRAINT `PK_Estados` PRIMARY KEY (`idEstado` ASC)
)
;
CREATE TABLE `Motivos`
(
`idMotivo` BIGINT NOT NULL COMMENT 'Identificador de motivo, secuencial auto generado.',
`codMotivo` BIGINT NULL COMMENT 'Código de motivo para el negocio.',
`descMotivo` VARCHAR(50) NULL COMMENT 'Descripción motivo.',
`idTipoDeMotivo` BIGINT NULL,
CONSTRAINT `PK_Motivos` PRIMARY KEY (`idMotivo` ASC)
)
COMMENT='Motivos para usos varios.'
;
CREATE TABLE `TiposDeMotivo`
(
`idTipoDeMotivo` BIGINT NOT NULL COMMENT 'Identificador único del tipo de motivo, secuencial auto generado.',
`codTipoDeMotivo` BIGINT NOT NULL COMMENT 'Código del tipo de motivo para el negocio.',
`descTipoDeMotivo` VARCHAR(50) NOT NULL COMMENT 'Descripción del tipo de motivo.',
`aliasTipoDeMotivo` VARCHAR(20) NOT NULL COMMENT 'Alias del tipo de motivo para uso desde el sistema.',
CONSTRAINT `PK_TiposDeMotivo` PRIMARY KEY (`idTipoDeMotivo` ASC)
)
COMMENT='Agrupan los motivos.'
;
\ No newline at end of file
#!/bin/bash
aws s3 sync s3://$bucket$path /data/$directory/
while :
do
echo "Container is still running"
sleep 5
done
\ No newline at end of file
This diff is collapsed.
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
<?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.
-->
<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.
-->
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath com.bytesw.bytebot.BytebotApplication -Djasypt.encryptor.password=179CD78D24F9BC63D6E677272D1A7 -Xms256M -Xmx512M</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath com.bytesw.bytebot.BytebotApplication -Djasypt.encryptor.password=179CD78D24F9BC63D6E677272D1A7 -Xms256M -Xmx512M</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath com.bytesw.bytebot.BytebotApplication -Djasypt.encryptor.password=179CD78D24F9BC63D6E677272D1A7 -Xms256M -Xmx512M</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>CUSTOM-clean install no test</actionName>
<displayName>clean install no test</displayName>
<goals>
<goal>clean</goal>
<goal>install</goal>
</goals>
<properties>
<skipTests>true</skipTests>
<dockerfile.skip>true</dockerfile.skip>
</properties>
</action>
<action>
<actionName>CUSTOM-basic cobertura</actionName>
<displayName>basic cobertura</displayName>
<goals>
<goal>cobertura:cobertura</goal>
</goals>
</action>
</actions>
This diff is collapsed.
package com.bytesw.bytebot;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication(scanBasePackages = "com.bytesw")
@ImportResource("classpath:application-config.xml")
@EnableCaching
@EnableAspectJAutoProxy
@EnableFeignClients(basePackages = "com.bytesw")
@EnableBatchProcessing
public class BytebotApplication {
public static void main(String[] args) {
SpringApplication.run(BytebotApplication.class, args);
}
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter @Setter
public class ActionSummaryByGoalBean implements Serializable {
@Expose
private String goal;
@Expose
private BigInteger count;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Agent;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author Sebastian Chicoma Sandmann
* @version 09-sep-2020
*
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
*
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter @Setter
@ToString
public class AgentBean {
@Expose
private Long id;
@Expose
private String name;
@Expose
private String description;
@Expose
private String version;
@Expose
private String status;
@Expose
private Long countryId;
@Expose
private String countryName;
@Expose
private String timezone;
@Expose
private String avatar;
@Expose
private String language;
@Expose
private String type;
@Expose
private int period;
@Expose
private List<DeploymentChannelBean> deploymentChannels;
@Expose
private List<FrequentQuestionBean> frequentQuestions;
public static AgentBean miniClone(Agent agent) {
AgentBean bean = new AgentBean();
bean.setId(agent.getId());
bean.setName(agent.getName());
bean.setVersion(agent.getVersion());
bean.setStatus(agent.getStatus().getName());
bean.setTimezone(agent.getTimezone());
bean.setAvatar(agent.getAvatar());
if (agent.getCountry() != null) {
bean.setCountryName(agent.getCountry().getName());
}
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class AirportBean {
@Expose
private Long id;
@Expose
private String airportName;
@Expose
private String airportLocation;
@Expose
private String otherDetails;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
@Getter @Setter
public class AverageBean implements Serializable {
@Expose
private BigDecimal firstResponseAverage;
@Expose
private BigDecimal sessionAverage;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter @Setter
public class BdcControlBean implements Serializable {
@Expose private Long id;
@Expose private String uuid;
@Expose private String fileName;
@Expose private String status;
@Expose private String user;
@Expose private String date;
@Expose private Long fileId;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
import java.time.OffsetDateTime;
@Getter
@Setter
public class BusinessParameterBean implements Serializable {
@Expose
private BigInteger id;
@Expose
private long version;
@Expose
private String key;
@Expose
private String description;
@Expose
private String required;
@Expose
private String defaultValue;
@Expose
private String currentValue;
@Expose
private OffsetDateTime dateFrom;
@Expose
private OffsetDateTime dateApplyFrom;
@Expose
private String programmedValue;
@Expose
private BigInteger currentConfigurationId;
@Expose
private BigInteger programmedConfigurationId;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
import java.time.OffsetDateTime;
@Getter @Setter
public class BusinessParameterConfigurationBean implements Serializable {
@Expose private BigInteger id;
@Expose private long version;
@Expose private OffsetDateTime from;
@Expose private OffsetDateTime to;
@Expose private String value;
@Expose private String programmedValue;
@Expose private BusinessParameterBean businessParameters;
@Expose private BigInteger currentConfigurationId;
@Expose private BigInteger programmedConfigurationId;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
import java.time.OffsetDateTime;
@Getter @Setter
public class BusinessParameterValueBean implements Serializable {
@Expose private String key;
@Expose private String description;
@Expose private boolean required;
@Expose private String defaultValue;
@Expose private String value;
@Expose private OffsetDateTime from;
@Expose private BigInteger id;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
public class CalendarBean implements Serializable {
@Expose
private String id;
@Expose
private long version;
@Expose
private String name;
//@TODO: Revisar List<WeekScheduler> weekSchedulerList de la clase Calendar
@Expose
private List<WeekSchedulerBean> weekSchedulerBeanList;
@Expose
private List<CalendarExceptionBean> calendarExceptionBeanList;
}
\ No newline at end of file
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@Getter
@Setter
public class CalendarExceptionBean {
@Expose
private BigInteger id;
@Expose
private long version;
@Expose
private String description;
@Expose
private CalendarBean calendar;
@Expose
private String calendarExceptionType;
//Frecuencia
@Expose
private String frequencyType;
//annualCalendar y UniqueWeekly
@Expose
private int month;
@Expose
private int dayOfMonth;
@Expose
private int weekOfMonth;
@Expose
private int dayOfWeek;
//UniqueCalendar
@Expose
private LocalDate date;
//rangeCalendar
@Expose
private OffsetDateTime from;
@Expose
private OffsetDateTime to;
@Expose
private boolean delete;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Channel;
import com.bytesw.bytebot.model.ChannelParam;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* @author Sebastian Chicoma Sandmann
* @version 10-sep-2020
* <p>
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class ChannelBean {
@Expose
private Long id;
@Expose
private String name;
@Expose
private String image;
@Expose
private List<ChannelParamBean> parameters;
@Expose
private String suggestTitle;
@Expose
private String suggestDetail;
public static ChannelBean clone(Channel channel) {
ChannelBean bean = new ChannelBean();
bean.setId(channel.getId());
bean.setName(channel.getName());
bean.setImage(channel.getImage());
bean.setParameters(new ArrayList<>());
bean.setSuggestTitle(channel.getSuggestTitle());
bean.setSuggestDetail(channel.getSuggestDetail());
if (channel.getParameters() != null) {
Collections.sort(channel.getParameters(), (o1, o2) -> o1.getOrder() - o2.getOrder());
for (ChannelParam param : channel.getParameters()) {
bean.getParameters().add(ChannelParamBean.clone(param));
}
}
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.ChannelParam;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author Sebastian Chicoma Sandmann
* @version 10-sep-2020
* <p>
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class ChannelParamBean {
@Expose
private String name;
@Expose
private String label;
@Expose
private Integer maxlength;
@Expose
private String type;
@Expose
private Boolean required;
@Expose
private Integer order;
@Expose
private String traductions;
@Expose
private String regex;
public static ChannelParamBean clone(ChannelParam channelParam) {
ChannelParamBean bean = new ChannelParamBean();
bean.setName(channelParam.getName());
bean.setLabel(channelParam.getLabel());
bean.setMaxlength(channelParam.getMaxlength());
bean.setRequired(channelParam.isRequired());
bean.setType(channelParam.getType());
bean.setOrder(channelParam.getOrder());
bean.setTraductions(channelParam.getTraductions());
bean.setRegex(channelParam.getRegex());
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Flight;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class CostBean {
@Expose
private Long id;
@Expose
private String airline;
@Expose
private Long flightId;
@Expose
private String fromDate;
@Expose
private String toDate;
@Expose
private Integer amount;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Country;
import com.bytesw.bytebot.model.Timezone;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.ArrayList;
import java.util.List;
/**
* @author Sebastian Chicoma Sandmann
* @version 10-sep-2020
* <p>
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class CountryBean {
@Expose
private Long id;
@Expose
private String name;
@Expose
private List<String> timezones;
public static CountryBean clone(Country country) {
CountryBean bean = new CountryBean();
bean.setId(country.getId());
bean.setName(country.getName());
bean.setTimezones(new ArrayList<>());
if (country.getTimezones() != null) {
for (Timezone timezone : country.getTimezones()) {
bean.getTimezones().add(timezone.getTimezone());
}
}
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author Sebastian Chicoma Sandmann
* @version 09-sep-2020
*
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
*
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class DeploymentChannelBean {
@Expose
private Long id;
@Expose
private String name;
@Expose
private String status;
@Expose
private Long channelId;
@Expose
private String channelName;
@Expose
private List<DeploymentChannelParamValueBean> parameters;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author Sebastian Chicoma Sandmann
* @version 09-sep-2020
*
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
*
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class DeploymentChannelParamValueBean {
@Expose
private Long id;
@Expose
private String channelParamName;
@Expose
private String value;
@Expose
private Long agen_id;
@Expose
private String channel;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Flight;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class FlightBean {
@Expose
private Long id;
@Expose
private String airline;
@Expose
private String airplane;
@Expose
private Long originAirportId;
@Expose
private String originAirportName;
@Expose
private Long destinationAirportId;
@Expose
private String destinationAirportName;
@Expose
private String departureDate;
@Expose
private String arrivalDate;
@Expose
private String departureTime;
@Expose
private String arrivalTime;
public static FlightBean miniClone(Flight flight) {
FlightBean bean = new FlightBean();
bean.setId(flight.getId());
bean.setAirplane(flight.getAirplane());
bean.setAirline(flight.getAirline());
bean.setArrivalDate(flight.getArrivalDate());
bean.setDepartureDate(flight.getDepartureDate());
bean.setArrivalTime(flight.getArrivalTime());
bean.setDepartureTime(flight.getDepartureTime());
bean.setOriginAirportName(flight.getOrigin().getAirportName());
bean.setDestinationAirportName(flight.getDestination().getAirportName());
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author Sebastian Chicoma Sandmann
* @version 09-sep-2020
* <p>
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Getter
@Setter
@ToString
public class FrequentQuestionBean {
@Expose
private Long id;
@Expose
private String uuid;
@Expose
private String filename;
@Expose
private String description;
@Expose
private String status;
@Expose
private String user;
@Expose
private String uploadDate;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Airport;
import com.bytesw.bytebot.model.Flight;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
public class LegBean {
@Expose
private Long id;
@Expose
private Long flightId;
@Expose
private Long originId;
@Expose
private Long destinationId;
@Expose
private String departureDate;
@Expose
private String arrivalDate;
@Expose
private String departureTime;
@Expose
private String arrivalTime;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter @Setter
public class MessageByIntentBean implements Serializable {
@Expose
private String identifier;
@Expose
private BigInteger count;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class PassengerBean implements Serializable {
@Expose
private Long id;
@Expose
private String firstName;
@Expose
private String secondName;
@Expose
private String lastName;
@Expose
private String phoneNumber;
@Expose
private String emailAddress;
@Expose
private String city;
@Expose
private String otherDetails;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class ProcessETLBean implements Serializable {
@Expose
private int id;
@Expose
private String name;
@Expose
private long version;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
@Getter
@Setter
public class ProxyBean {
@Expose
private Long id;
@Expose
private String name;
@Expose
private String details;
}
package com.bytesw.bytebot.bean;
import lombok.Getter;
import lombok.Setter;
import java.time.OffsetDateTime;
@Getter @Setter
public class RangeBean {
private OffsetDateTime startDate;
private OffsetDateTime endDate;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Reservation;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ReservationBean {
@Expose
private Long id;
@Expose
private Long proxyId;
@Expose
private String proxyName;
@Expose
private Long passengerId;
@Expose
private String passengerName;
@Expose
private String travelTypeClass;
@Expose
private Integer numberInParty;
public static ReservationBean miniClone(Reservation reservation) {
ReservationBean bean = new ReservationBean();
bean.setId(reservation.getId());
bean.setTravelTypeClass(reservation.getTravelTypeClass());
bean.setNumberInParty(reservation.getNumberInParty());
bean.setProxyName(reservation.getProxy().getName());
bean.setPassengerName(reservation.getPassenger().getFirstName() + ' ' + reservation.getPassenger().getLastName());
return bean;
}
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter
@Setter
public class SchedulerTaskBean implements Serializable {
@Expose
private BigInteger id;
@Expose
private long version;
@Expose
private String description;
@Expose
private String internals;
@Expose
private String cronExpression;
@Expose
private String stringParameters;
@Expose
private Integer etlId;
@Expose
private String calendarID;
@Expose
private String calendarName;
// @Expose
// private int idEtl;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter @Setter
public class SessionByClientBean implements Serializable {
@Expose
private BigInteger user_id;
@Expose
private String sender_id;
@Expose
private BigInteger count;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@Getter @Setter
public class SummaryBean implements Serializable {
@Expose
private BigInteger value;
@Expose
private BigDecimal percent;
@Expose
private List<ArrayList<Object>> history;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter @Setter
public class SummaryMessageByIntentBean implements Serializable {
@Expose
private Long id;
@Expose
private String identifier;
@Expose
private BigInteger count;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigInteger;
@Getter @Setter
public class SummaryMessageBySentenceBean implements Serializable {
@Expose
private Long id;
@Expose
private String identifier;
@Expose
private String sentence;
@Expose
private BigInteger count;
@Expose
private BigInteger customerCount;
}
package com.bytesw.bytebot.bean;
import com.bytesw.bytebot.model.Passenger;
import com.bytesw.bytebot.model.Proxy;
import com.google.gson.annotations.Expose;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class ViewReservationBean {
@Expose
private Long id;
@Expose
private String proxy;
@Expose
private String passenger;
@Expose
private String travelTypeClass;
@Expose
private Integer numberInParty;
}
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.math.BigInteger;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
@Getter
@Setter
public class WeekSchedulerBean {
@Expose
private BigInteger id;
@Expose
private long version;
@Expose
private int dayOfWeek;
@Expose
private OffsetTime from;
@Expose
private OffsetTime to;
@Expose
private String calendarID;
@Expose
private String calendarName;
}
package com.bytesw.bytebot.config;
import com.bytesw.bytebot.routes.SFTPRoute;
import lombok.extern.log4j.Log4j2;
import org.apache.camel.CamelContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
@Log4j2
public class CamelConfig {
@Autowired
private CamelContext camelContext;
@Autowired
private SFTPRoute sftpRoute;
@PostConstruct
public void addBuilder() throws Exception {
camelContext.addRoutes(sftpRoute);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.etl.beans.ActionBean;
import com.bytesw.bytebot.service.ActionService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/actions")
@ProgramSecurity("ACTIONS")
@Log4j2
public class ActionController extends XDFController<ActionBean, Long> {
public ActionController(ActionService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.AgentBean;
import com.bytesw.bytebot.controller.bean.ResponseController;
import com.bytesw.bytebot.http.FileValidationResponse;
import com.bytesw.bytebot.service.*;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import java.security.Principal;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@Log4j2
@RestController
@RequestMapping("/service/agent")
@ProgramSecurity("conversational_agent")
public class AgentController {
@Autowired
private AgentService agentService;
@Autowired
private FileManagementService fileManagementService;
@Autowired
private GsonBuilder gsonBuilder;
@Autowired
private OrquestadorService orquestadorService;
@PostMapping(value = "/page")
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> paginationConversationalAgent(@RequestBody Pagination<AgentBean> pagination) {
HttpStatus hs = HttpStatus.OK;
try {
agentService.searchByPagination(pagination);
return new ResponseEntity<>(gsonBuilder.create().toJson(pagination), hs);
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@GetMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getConversartionalAgentById(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
HttpStatus hs = HttpStatus.OK;
try {
return new ResponseEntity<>(gsonBuilder.create().toJson(agentService.getAgent(id)), hs);
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@PutMapping(value = "/")
@PreAuthorize("hasPermission(this, 'new')")
public ResponseEntity<String> createConversationalAgent(@RequestBody AgentBean agentBean) {
HttpStatus hs = HttpStatus.OK;
try {
agentService.save(agentBean);
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.insert.success", hs.value())), hs);
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@PutMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'edit')")
public ResponseEntity<String> updateConversationalAgent(@PathVariable("id") Long id,
@RequestBody AgentBean agentBean) {
HttpStatus hs = HttpStatus.OK;
try {
if (id != null) {
agentService.save(agentBean);
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.update.success", hs.value())), hs);
} else {
hs = HttpStatus.UNAUTHORIZED;
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.update.error", hs.value())), hs);
}
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@DeleteMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'delete')")
public ResponseEntity<String> deleteConversationalAgent(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
HttpStatus hs = HttpStatus.OK;
try {
if (id != null) {
boolean deleteValid = agentService.delete(id);
if (deleteValid) {
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.delete.success", hs.value())), hs);
} else {
// hs = HttpStatus.FAILED_DEPENDENCY;
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.delete.error.integrity", hs.FAILED_DEPENDENCY.value())), hs);
}
} else {
hs = HttpStatus.UNAUTHORIZED;
return new ResponseEntity<>(gsonBuilder.create().toJson(new ResponseController("agent.delete.error.unauthtorized", hs.value())), hs);
}
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@GetMapping(value = "/countries")
public ResponseEntity<String> getCountries() {
HttpStatus hs = HttpStatus.OK;
try {
return new ResponseEntity<>(gsonBuilder.create().toJson(agentService.getCountries()), hs);
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@GetMapping(value = "/channels")
public ResponseEntity<String> getChannels() {
HttpStatus hs = HttpStatus.OK;
try {
return new ResponseEntity<>(gsonBuilder.create().toJson(agentService.getChannels()), hs);
} catch (Exception e) {
log.error("Error detectado: ", e);
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(ExceptionUtils.getFullStackTrace(e)), hs);
}
}
@PostMapping("/file-upload")
public ResponseEntity<String> uploadFile(@RequestParam("file") MultipartFile file, Principal principal) {
Gson gson = gsonBuilder.create();
try {
String uuid = UUID.randomUUID().toString();
FileValidationResponse response = orquestadorService.executeGenerateBCD(uuid, file);
response.setUser(principal != null ? principal.getName() : null);
return new ResponseEntity<>(gson.toJson(response), HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
}
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
@PutMapping("/file-upload/{uuid}")
public ResponseEntity<String> uploadFile(@PathVariable("uuid") String uuid, Principal principal) {
Gson gson = gsonBuilder.create();
try {
FileValidationResponse response = orquestadorService.retry(uuid);
response.setUser(principal != null ? principal.getName() : null);
return new ResponseEntity<>(gson.toJson(response), HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@DeleteMapping("/file-upload/{uuid}")
public ResponseEntity<String> deleteBdc(@ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) {
Gson gson = gsonBuilder.create();
Map<String, String> resp = new HashMap<>();
try {
orquestadorService.deleteBcd(uuid);
resp.put("message", "OK");
return new ResponseEntity<>(gson.toJson(resp), HttpStatus.OK);
} catch (Exception e) {
resp.put("message", "ERROR");
return new ResponseEntity<>(gson.toJson(resp), HttpStatus.OK);
}
}
@GetMapping("/synchronize/{id}")
public ResponseEntity<String> synchronizeFiles(@PathVariable("id") Long id,
@RequestParam("user") String user) {
Gson gson = new GsonBuilder().create();
try {
agentService.synchronizeFiles(id, user);
return new ResponseEntity<>(HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping(value = "/")
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getAgentAll() {
HttpStatus hs = HttpStatus.OK;
try {
return new ResponseEntity<>(gsonBuilder.create().toJson(agentService.getAgentAll()), hs);
} catch (Exception e) {
String info = "Error detectado al obtener informacion";
hs = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(gsonBuilder.create().toJson(info), hs);
}
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.AirportBean;
import com.bytesw.bytebot.service.AirportService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/airport")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class AirportController extends XDFController<AirportBean, Long> {
@Autowired
private AirportService service;
@Autowired
protected GsonBuilder gsonBuilder;
public AirportController(AirportService service) {
super(service);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.DELETE}
)
public ResponseEntity<String> delete(@PathVariable("id") Long id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(
value = {"/"},
method = {RequestMethod.POST}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 409,
message = "Already Exists"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> create(@RequestBody AirportBean bean, HttpServletRequest req) {
bean = this.service.create(bean);
return new ResponseEntity(this.gson.toJson(bean), HttpStatus.OK);
}
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.PUT}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody AirportBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
AirportBean actualBean = this.service.getById(id);
return new ResponseEntity(this.gson.toJson(actualBean), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.google.gson.GsonBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@RestController
public class AppSettingsController {
@Value("${application.logo.type:png}")
private String type;
@Value("classpath:logo.txt")
Resource resourceFile;
@Value("${application.show-side-bar:true}")
private boolean showSideBar;
@Autowired
private GsonBuilder gsonBuilder;
@GetMapping("/settings/information")
public ResponseEntity<String> getAppSettings() {
HttpStatus hs = HttpStatus.OK;
Map<String, Object> appSettings = new HashMap<>();
appSettings.put("tipo", type);
appSettings.put("logoBase64", getDefaultLogo());
//you
// appSettings.put("showSideBar", true);
return new ResponseEntity<>(gsonBuilder.disableHtmlEscaping().create().toJson(appSettings), hs);
}
public String getDefaultLogo() {
String str = "";
StringBuffer buf = new StringBuffer();
InputStream is = null;
try {
is = resourceFile.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
if (is != null) {
while ((str = reader.readLine()) != null) {
buf.append(str + "" );
}
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try { is.close(); } catch (Throwable ignore) {}
}
return buf.toString();
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.BdcControlBean;
import com.bytesw.bytebot.service.BcdControlService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/bcdControl")
@ProgramSecurity("BCDCONTROL")
@Log4j2
public class BdcControlController extends XDFController<BdcControlBean, Long> {
public BdcControlController(BcdControlService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.service.BusinessParameterConfigurationService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.bytebot.bean.BusinessParameterConfigurationBean;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigInteger;
@RestController()
@RequestMapping("/service/settings/business-parameter-configuration")
@ProgramSecurity("BUSINESS_PARAMETERS_CONFIGURATION")
@Log4j2
public class BusinessParameterConfigurationController extends XDFController<BusinessParameterConfigurationBean, BigInteger> {
public BusinessParameterConfigurationController(BusinessParameterConfigurationService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.BusinessParameterBean;
import com.bytesw.bytebot.bean.BusinessParameterValueBean;
import com.bytesw.bytebot.bean.BusinessParameterConfigurationBean;
import com.bytesw.bytebot.service.BusinessParameterService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.xdf.exception.ReferentialIntegrityException;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.time.OffsetDateTime;
import java.util.List;
@RestController()
@RequestMapping("/service/settings/business-parameter")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class BusinessParameterController extends XDFController<BusinessParameterBean, BigInteger> {
@Autowired BusinessParameterService service;
@Autowired
protected GsonBuilder gsonBuilder;
public BusinessParameterController(BusinessParameterService service) {
super(service);
}
@RequestMapping(value = {"/value/{key}"}, method = {RequestMethod.PUT})
@ApiResponses({
@ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
@ApiResponse(code = 404,message = "Not Found"),
@ApiResponse(code = 409,message = "Already exists"),
@ApiResponse(code = 505, message = "Internal Server Error")
})
@PreAuthorize("hasPermission(this, 'edit')")
public ResponseEntity<Void> addNewAddValue(
@ApiParam(value = "key", required = true) @PathVariable("key") String key,
@ApiParam(value = "value", required = true) @RequestParam("value") String value,
@ApiParam(value = "from", required = false) @RequestParam("from") String fromString) {
OffsetDateTime from = OffsetDateTime.parse(fromString);
this.service.addValue(key, value, from);
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(value = {"/create"}, method = {RequestMethod.POST})
@ApiResponses({
@ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
@ApiResponse(code = 409, message = "Already Exists"),
@ApiResponse(code = 505, message = "Internal Server Error")
})
@PreAuthorize("hasPermission(this, 'new')")
public ResponseEntity<String> createWithValue(@RequestBody BusinessParameterValueBean bean, HttpServletRequest req) {
Gson gson = gsonBuilder.create();
bean = this.service.createWithValue(bean);
return new ResponseEntity(gson.toJson(bean), HttpStatus.OK);
}
@RequestMapping(value = {"/current/{key}"}, method = {RequestMethod.GET})
@ApiResponses({
@ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
@ApiResponse(code = 404,message = "Not Found"),
@ApiResponse(code = 409, message = "Already Exists"),
@ApiResponse(code = 505, message = "Internal Server Error")
})
@PreAuthorize("hasPermission(this, 'new')")
public ResponseEntity<String> getCurrentValue(@ApiParam(value = "key", required = true) @PathVariable("key") String key) {
Gson gson = gsonBuilder.create();
// String value = this.service.getCurrentValue(key);
String value = this.service.getCurrentValueParameterByKey(key);
return new ResponseEntity(gson.toJson(value), HttpStatus.OK);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
method = {RequestMethod.GET},
value = {"/parameter-value/{key}"}
)
@ResponseBody
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getFeaturesTemplate(@PathVariable("key") String key) {
String featuresTemplate = ((BusinessParameterService)this.service).getCurrentValueParameterByKey(key);
return new ResponseEntity(this.gson.toJson(featuresTemplate), HttpStatus.OK);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
method = {RequestMethod.POST},
value = {"/page"}
)
@ResponseBody
@Override
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> findAllByPagination(@RequestBody Pagination<BusinessParameterBean> pagination) {
if (pagination.getFilterExpression()!=null) {
if (pagination.getFilterExpression().contains("(required==Y)")) {
pagination.setFilterExpression(pagination.getFilterExpression().replace("(required==Y)", "(required==true)"));
}
}
this.service.searchByPagination(pagination);
return new ResponseEntity(this.gson.toJson(pagination), HttpStatus.OK);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.DELETE}
)
@PreAuthorize("hasPermission(this, 'delete')")
public ResponseEntity<String> delete(@PathVariable("id") BigInteger id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.PUT}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@PreAuthorize("hasPermission(this, 'edit')")
public ResponseEntity<String> update(@PathVariable("id") BigInteger id, @RequestBody BusinessParameterBean bean, HttpServletRequest req) {
try {
if (this.service.validateKey(bean)) {
throw new ReferentialIntegrityException("Ya existe un identificador con el mismo nombre");
} else {
this.service.update(bean, id);
}
} catch (ObjectOptimisticLockingFailureException var6) {
BusinessParameterBean actualBean = this.service.getById(id);
return new ResponseEntity(this.gson.toJson(actualBean), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(
value = {"/"},
method = {RequestMethod.POST}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 409,
message = "Already Exists"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@PreAuthorize("hasPermission(this, 'new')")
public ResponseEntity<String> create(@RequestBody BusinessParameterBean bean, HttpServletRequest req) {
if (this.service.validateKey(bean)) {
throw new ReferentialIntegrityException("Ya existe un identificador con el mismo nombre");
} else {
bean = this.service.createBP(bean);
return new ResponseEntity(this.gson.toJson(bean), HttpStatus.OK);
}
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/searchKey/{busnessKey}"},
method = {RequestMethod.GET}
)
@PreAuthorize("hasPermission(this, 'showHistory')")
public ResponseEntity<String> findByKey(@PathVariable("busnessKey") BigInteger busnessKey, HttpServletRequest req) {
List<BusinessParameterConfigurationBean> bean = this.service.getConfigurationParametersList(busnessKey);
return new ResponseEntity(this.gson.toJson(bean), HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.CalendarBean;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.bytebot.service.CalendarService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/calendar")
@ProgramSecurity("CALENDAR")
@Log4j2
public class CalendarController extends XDFController<CalendarBean, String> {
public CalendarController(CalendarService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.CalendarExceptionBean;
import com.bytesw.bytebot.service.CalendarExceptionService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
@RestController()
@RequestMapping("/service/settings/calendar-exception")
@ProgramSecurity("CALENDAR-EXCEPTION")
@Log4j2
public class CalendarExceptionController extends XDFController<CalendarExceptionBean, BigInteger> {
@Autowired
CalendarExceptionService service;
public CalendarExceptionController(CalendarExceptionService service) {
super(service);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/find-by-calendar-id"},
method = {RequestMethod.POST}
)
@ResponseBody
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getCalendarExceptionbyID(@RequestBody Map<String, String> parametersCalendar, HttpServletRequest req) {
List<CalendarExceptionBean> calendarExceptionBeanList = this.service.getCalendarExceptionbyID(parametersCalendar);
return new ResponseEntity(this.gson.toJson(calendarExceptionBeanList), HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.CostBean;
import com.bytesw.bytebot.bean.LegBean;
import com.bytesw.bytebot.service.CostService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/cost")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class CostController {
@Autowired
private CostService service;
@Autowired
protected GsonBuilder gson;
@PostMapping(value = "/")
public ResponseEntity<String> create(@RequestBody CostBean bean, HttpServletRequest req) {
this.service.create(bean);
return new ResponseEntity(gson.create().toJson(bean), HttpStatus.OK);
}
@GetMapping(value = "/flight/{id}")
public ResponseEntity<String> findAllCosts(@ApiParam(value = "id", required = true) @PathVariable("id") Long id, HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getCost(id)), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PutMapping(value = "/{id}")
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody CostBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
return new ResponseEntity(gson.create().toJson("error"), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.SummaryMessageBySentenceBean;
import com.bytesw.bytebot.service.dashboard.CustomerInteractionDashboardService;
import com.bytesw.bytebot.service.dashboard.OperativeDashboardService;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/dashboard")
public class DashboardController {
@Autowired
private OperativeDashboardService operativeDashboardService;
@Autowired
private CustomerInteractionDashboardService customerInteractionDashboardService;
@Autowired
private Gson gson;
@PostMapping("/operative")
public ResponseEntity<String> getOperativeInfo(@RequestBody Map<String, Object> body) {
Map<String, Object> info = operativeDashboardService.generateInfo(body);
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
}
@PostMapping("/operative/sentence-by-intent/page")
public ResponseEntity<String> getSentenceByIntentPage(@RequestBody Pagination<SummaryMessageBySentenceBean> pagination) {
customerInteractionDashboardService.getSummaryBySentencePagination(pagination);
return new ResponseEntity<>(gson.toJson(pagination), HttpStatus.OK);
}
@PostMapping("/customer-interaction")
public ResponseEntity<String> getCustomerInteractionInfo(@RequestBody Map<String, Object> body) {
Map<String, Object> info = customerInteractionDashboardService.generateInfo(body);
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
}
@PostMapping("/customer-interaction/message-by-intent/page")
public ResponseEntity<String> getMessageByIntentPage(@RequestBody Pagination<SummaryMessageBySentenceBean> pagination) {
customerInteractionDashboardService.getSummaryByIntentAndSentencePagination(pagination);
return new ResponseEntity<>(gson.toJson(pagination), HttpStatus.OK);
}
@GetMapping("/test")
public ResponseEntity<String> getTest() {
Map<String, Object> data = customerInteractionDashboardService.generateInfo(new HashMap<>());
return new ResponseEntity<>(gson.toJson(data), HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.AirportBean;
import com.bytesw.bytebot.bean.FlightBean;
import com.bytesw.bytebot.bean.ReservationBean;
import com.bytesw.bytebot.service.AirportService;
import com.bytesw.bytebot.service.FlightService;
import com.bytesw.bytebot.service.ReservationService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/flight")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class FlightController {
@Autowired
private FlightService service;
@Autowired
private GsonBuilder gson;
@DeleteMapping(value = "/{id}")
public ResponseEntity<String> delete(@PathVariable("id") Long id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@PostMapping(value = "/")
public ResponseEntity<String> create(@RequestBody FlightBean bean, HttpServletRequest req) {
Long id = this.service.create(bean);
bean.setId(id);
return new ResponseEntity(gson.create().toJson(bean), HttpStatus.OK);
}
@PutMapping(value = "/{id}")
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody FlightBean bean, HttpServletRequest req) {
try {
Long ide = this.service.update(bean, id);
bean.setId(ide);
return new ResponseEntity(gson.create().toJson(bean), HttpStatus.OK);
} catch (ObjectOptimisticLockingFailureException var6) {
return new ResponseEntity(gson.create().toJson("error"), HttpStatus.CONFLICT);
}
}
@GetMapping(value = "/{id}")
public ResponseEntity<String> findOne(@ApiParam(value = "id", required = true) @PathVariable("id") Long id, HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getFlight(id)), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping(value = "/")
public ResponseEntity<String> findAll(HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getFlightAll()), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson("Error detectado al obtener informacion"), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PostMapping(value = "/page")
public ResponseEntity<String> paginationReservation(@RequestBody Pagination<FlightBean> pagination) {
try {
this.service.searchByPagination(pagination);
return new ResponseEntity<>(gson.create().toJson(pagination), HttpStatus.OK);
} catch (Exception e) {
log.error("Error detectado: ", e);
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.service.GoalService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.google.gson.GsonBuilder;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController()
@RequestMapping("/service/settings/goal")
@ProgramSecurity("GOAL")
@Log4j2
public class GoalController extends XDFController<Map, Long> {
@Autowired
private GoalService goalService;
@Autowired
private GsonBuilder gsonBuilder;
public GoalController(GoalService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.etl.beans.GoalForActionsBean;
import com.bytesw.bytebot.service.GoalForActionService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/goal-for-actions")
@ProgramSecurity("GOALFORACTIONS")
@Log4j2
public class GoalForActionController extends XDFController<GoalForActionsBean, Long> {
public GoalForActionController(GoalForActionService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.FlightBean;
import com.bytesw.bytebot.bean.LegBean;
import com.bytesw.bytebot.bean.ReservationBean;
import com.bytesw.bytebot.service.LegService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/leg")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class LegController {
@Autowired
private LegService service;
@Autowired
protected GsonBuilder gson;
@PostMapping(value = "/")
public ResponseEntity<String> create(@RequestBody LegBean bean, HttpServletRequest req) {
this.service.create(bean);
return new ResponseEntity(gson.create().toJson(bean), HttpStatus.OK);
}
@GetMapping(value = "/flight/{id}")
public ResponseEntity<String> findAllLegs(@ApiParam(value = "id", required = true) @PathVariable("id") Long id, HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getLeg(id)), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PutMapping(value = "/{id}")
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody LegBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
return new ResponseEntity(gson.create().toJson("error"), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.PassengerBean;
import com.bytesw.bytebot.service.PassengerService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
@RestController()
@RequestMapping("/service/settings/passenger")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class PassengerController extends XDFController<PassengerBean, Long> {
@Autowired
private PassengerService service;
@Autowired
protected GsonBuilder gsonBuilder;
public PassengerController(PassengerService service) {
super(service);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.DELETE}
)
public ResponseEntity<String> delete(@PathVariable("id") Long id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(
value = {"/"},
method = {RequestMethod.POST}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 409,
message = "Already Exists"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> create(@RequestBody PassengerBean bean, HttpServletRequest req) {
bean = this.service.create(bean);
return new ResponseEntity(this.gson.toJson(bean), HttpStatus.OK);
}
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.PUT}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody PassengerBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
PassengerBean actualBean = this.service.getById(id);
return new ResponseEntity(this.gson.toJson(actualBean), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.CalendarBean;
import com.bytesw.bytebot.bean.ProcessETLBean;
import com.bytesw.bytebot.service.CalendarService;
import com.bytesw.bytebot.service.ProcessETLService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/ProcessETL")
@ProgramSecurity("PROCESSETL")
@Log4j2
public class ProcessETLController extends XDFController<ProcessETLBean, Integer> {
public ProcessETLController(ProcessETLService service) {
super(service);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.service.provider.TwilioService;
import com.bytesw.xdf.exception.NotFoundException;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import com.twilio.exception.AuthenticationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.google.gson.Gson;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;
@Log4j2
@RestController
@RequestMapping("/providers")
public class ProviderController {
@Autowired
private TwilioService twilioService;
@Autowired
private Gson gson;
@ApiResponses(value={
@ApiResponse(code=200, message = "OK"),
@ApiResponse(code=400, message = "Bad Request. Datos de entrada inválido"),
@ApiResponse(code=401, message = "Unauthorized. Credenciales erróneas"),
@ApiResponse(code=404, message = "Not Found. Recursos no encontrados")
})
@RequestMapping(value="/twilio/messages/{sid_message}",method = {RequestMethod.DELETE})
public ResponseEntity<String> deleteSensibleInfo(@ApiParam(value="sid_message",required = true) @PathVariable("sid_message") String sid_message,
@ApiParam(value = "agent_id: Agente a cual eliminar su data sensible\n{\"agent_id\":1}",
example = "{agent_id:1}",required = true) @NotNull @RequestBody(required = false) Map<String,Object> body){
Map<String,Object> info = new HashMap<>();
try {
if (body == null) {
log.info("Body Input Inválido");
throw new ClassCastException("Input inválido");
}
info = twilioService.generateInfo(sid_message, body);
}catch (ClassCastException e){
return new ResponseEntity<>(e.getMessage(),HttpStatus.BAD_REQUEST);
}catch(NotFoundException e){
return new ResponseEntity<>(e.getMessage(),HttpStatus.NOT_FOUND);
}catch (AuthenticationException e){
return new ResponseEntity<>(e.getMessage(),HttpStatus.UNAUTHORIZED);
}catch (InternalError e){
return new ResponseEntity<>(e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.ProxyBean;
import com.bytesw.bytebot.service.ProxyService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/proxy")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class ProxyController extends XDFController<ProxyBean, Long> {
@Autowired
private ProxyService service;
@Autowired
protected GsonBuilder gsonBuilder;
public ProxyController(ProxyService service) {
super(service);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.DELETE}
)
public ResponseEntity<String> delete(@PathVariable("id") Long id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@RequestMapping(
value = {"/"},
method = {RequestMethod.POST}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 409,
message = "Already Exists"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> create(@RequestBody ProxyBean bean, HttpServletRequest req) {
bean = this.service.create(bean);
return new ResponseEntity(this.gson.toJson(bean), HttpStatus.OK);
}
@RequestMapping(
value = {"/{id}"},
method = {RequestMethod.PUT}
)
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 404,
message = "Not Found"
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody ProxyBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
ProxyBean actualBean = this.service.getById(id);
return new ResponseEntity(this.gson.toJson(actualBean), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.AgentBean;
import com.bytesw.bytebot.bean.ReservationBean;
import com.bytesw.bytebot.service.ReservationService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController()
@RequestMapping("/service/settings/reservation")
@ProgramSecurity("BUSINESS-PARAMETERS")
@Log4j2
public class ReservationController {
@Autowired
private ReservationService service;
@Autowired
private GsonBuilder gson;
@DeleteMapping(value = "/{id}")
public ResponseEntity<String> delete(@PathVariable("id") Long id, HttpServletRequest req) {
this.service.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@PostMapping(value = "/")
public ResponseEntity<String> create(@RequestBody ReservationBean bean, HttpServletRequest req) {
this.service.create(bean);
return new ResponseEntity(gson.create().toJson(bean), HttpStatus.OK);
}
@PutMapping(value = "/{id}")
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody ReservationBean bean, HttpServletRequest req) {
try {
this.service.update(bean, id);
} catch (ObjectOptimisticLockingFailureException var6) {
return new ResponseEntity(gson.create().toJson("error"), HttpStatus.CONFLICT);
}
return new ResponseEntity(HttpStatus.OK);
}
@GetMapping(value = "/{id}")
public ResponseEntity<String> findOne(@ApiParam(value = "id", required = true) @PathVariable("id") Long id, HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getReservation(id)), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping(value = "/")
public ResponseEntity<String> findAll(HttpServletRequest req) {
try {
return new ResponseEntity<>(gson.create().toJson(this.service.getReservationAll()), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson("Error detectado al obtener informacion"), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PostMapping(value = "/page")
public ResponseEntity<String> paginationReservation(@RequestBody Pagination<ReservationBean> pagination) {
try {
this.service.searchByPagination(pagination);
return new ResponseEntity<>(gson.create().toJson(pagination), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(gson.create().toJson(ExceptionUtils.getFullStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.SchedulerTaskBean;
import com.bytesw.bytebot.service.SchedulerTaskService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import com.bytesw.xdf.sql.beans.Pagination;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController()
@RequestMapping("/service/settings/scheduler-task")
@ProgramSecurity("SCHEDULER-TASK")
@Log4j2
public class SchedulerTaskController extends XDFController<SchedulerTaskBean, BigInteger> {
public SchedulerTaskController(SchedulerTaskService service) {
super(service);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
method = {RequestMethod.POST},
value = {"/page"}
)
@ResponseBody
@Override
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> findAllByPagination(@RequestBody Pagination<SchedulerTaskBean> pagination) {
if (!Objects.isNull(pagination.getFilterExpression()) && !pagination.getFilterExpression().isEmpty()) {
String filterExpression = pagination.getFilterExpression();
if (filterExpression.contains("(internals==Y)")) {
filterExpression = filterExpression.replace("(internals==Y)", "(internals==true)");
}
if (filterExpression.contains("calendarName")) {
filterExpression = filterExpression.replace("calendarName", "calendar.name");
}
pagination.setFilterExpression(filterExpression);
}
this.service.searchByPagination(pagination);
return new ResponseEntity(this.gson.toJson(pagination), HttpStatus.OK);
}
@ApiResponses({@ApiResponse(
code = 200,
message = "Success",
response = ResponseEntity.class
), @ApiResponse(
code = 505,
message = "Internal Server Error"
)})
@RequestMapping(
method = {RequestMethod.GET},
value = {"/initial-data"}
)
@ResponseBody
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getInitialData() {
Map<String, List> initialData = ((SchedulerTaskService) this.service).getInitialData();
return new ResponseEntity(this.gson.toJson(initialData), HttpStatus.OK);
}
}
package com.bytesw.bytebot.controller.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
/**
* @author Sebastian Chicoma Sandmann.
* @version 09-sep-2020
*
* Copyright (c) 2020 Byte, S.A. Todos los derechos reservados.
*
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*
*/
@Getter
@Setter
@ToString
public class ResponseController implements Serializable {
@Expose
private String message;
@Expose
private int statusCode;
@Expose
private Object additionalData;
public ResponseController() {
}
public ResponseController(String message, int statusCode) {
this.message = message;
this.statusCode = statusCode;
}
public ResponseController(String message, int statusCode, Object additionalData) {
this.message = message;
this.statusCode = statusCode;
this.additionalData = additionalData;
}
}
package com.bytesw.bytebot.controller.sso;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
@Controller
@Log4j2
@ConditionalOnProperty(
name="application.services.security",
havingValue = "oauth2sso",
matchIfMissing = false)
public class LoginController {
@RequestMapping(value = {"/home"}, method = RequestMethod.GET)
public final String home(HttpServletRequest request, HttpServletResponse response, Principal principal) {
System.out.println("* home *****> " + request.getSession(false).getId());
System.out.println(request.getSession().getAttribute("username"));
return "home";
}
@RequestMapping(value = {"/mylogin"})
public final String mylogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("* mylogin *****> " + request.getSession(false).getId());
System.out.println(request.getSession().getAttribute("username"));
return "home";
}
}
package com.bytesw.bytebot.controller.sso;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
/**
* @author Marco A. Ortíz García
* @version 2019-03-16.
* <p>
* <p>
* Copyright (c) 2018 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Controller
@ConditionalOnProperty(
name="application.services.security",
havingValue = "oauth2sso",
matchIfMissing = false)
@Log4j2
public class LogoutController {
@Value("${application.services.security.token-key:#{null}}")
private String tokenKey;
@RequestMapping(value = {"/goodbye"}, method = RequestMethod.GET)
public final String goodbye(HttpServletRequest request, HttpServletResponse response, Principal principal, Model model) {
model.addAttribute("token", tokenKey != null);
return "goodbye";
}
}
package com.bytesw.bytebot.controller.sso;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
@Controller
@ConditionalOnProperty(
name="application.services.security",
havingValue = "oauth2sso",
matchIfMissing = false)
@Log4j2
public class TokenFailController {
@RequestMapping(value = {"/token-fail"}, method = RequestMethod.GET)
public final String goodbye(HttpServletRequest request, HttpServletResponse response, Principal principal) {
return "/token-fail";
}
}
package com.bytesw.bytebot.etl.batch.beans;
import lombok.*;
import java.io.Serializable;
@Getter @Setter
@EqualsAndHashCode
@AllArgsConstructor
@ToString
public class AttributeValueBean implements Serializable {
private final String identifier;
private String value;
private final Long dataTypeId;
}
package com.bytesw.bytebot.etl.batch.beans;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
@Configuration
public class DBConfig{
@Value("${spring.datasource.driverClassName}")
private String classDriver;
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String user;
@Value("${spring.datasource.password}")
private String password;
@Bean
public DataSource dataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(classDriver);
dataSource.setUrl(url);
dataSource.setUsername(user);
dataSource.setPassword(password);
return dataSource;
}
}
\ No newline at end of file
package com.bytesw.bytebot.etl.batch.beans;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DeleteDataSensBean {
private Long id;
private String channelValue;
private String value;
private Long agenId;
private Long deletePeriod;
}
package com.bytesw.bytebot.etl.batch.beans;
import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp;
@Getter
@Setter
public class DeleteDataSensControlBean {
private Long id;
private Long agenId;
private Timestamp dateDelete;
private Long eventId;
}
\ No newline at end of file
package com.bytesw.bytebot.etl.batch.beans;
import lombok.Getter;
import lombok.Setter;
import java.time.OffsetDateTime;
@Getter @Setter
public class DeleteDataSensRegistryBean {
private Long id;
private Long inten_id;
private String sender_id;
private String message_sid;
private String multimedia_sid;
private OffsetDateTime update_time;
}
package com.bytesw.bytebot.etl.batch.beans;
import java.util.HashMap;
public class DynaBean extends HashMap<String, Object> {
}
package com.bytesw.bytebot.etl.batch.beans;
import lombok.Getter;
import lombok.Setter;
import java.util.Map;
@Getter @Setter
public class TenantBatchBean {
private String id;
private Map<String, String> datasource;
}
package com.bytesw.bytebot.etl.batch.factory.mapper;
import java.util.Map;
public interface MapperFactory<T> {
T createMapper(Map<String, Object> params);
}
package com.bytesw.bytebot.etl.batch.factory.mapper;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import com.bytesw.bytebot.etl.batch.mapper.DynaBeanRowMapper;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class RowMapperFactory implements MapperFactory<DynaBeanRowMapper<DynaBean>>{
@Override
public DynaBeanRowMapper<DynaBean> createMapper(Map<String, Object> params) {
DynaBeanRowMapper<DynaBean> rowMapper = new DynaBeanRowMapper<>();
return rowMapper;
}
}
package com.bytesw.bytebot.etl.batch.factory.reader;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.database.JdbcCursorItemReader;
@Log4j2
public class ByteDataBaseItemReaderFactory<T> extends JdbcCursorItemReader<T> implements StepExecutionListener {
@Override
public void beforeStep(StepExecution stepExecution) {
}
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
closeDatabase();
return stepExecution.getExitStatus();
}
private void closeDatabase() {
if (this.getDataSource() instanceof BasicDataSource) {
BasicDataSource dataSource = (BasicDataSource) this.getDataSource();
if (!dataSource.isClosed()) {
try {
dataSource.close();
} catch (Exception e) {
log.debug(e.getMessage());
}
}
}
}
}
package com.bytesw.bytebot.etl.batch.factory.reader;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.JdbcCursorItemReader;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.util.Map;
/**
* Params:
* -jdbc-driver
* -username
* -password
* -jdbc-url
* -query
*/
@Component
@Log4j2
public class DataBaseItemReaderFactory implements ItemReaderFactory<DynaBean, RowMapper<DynaBean>> {
@Override
public ItemReader<DynaBean> createReader(RowMapper<DynaBean> mapper, Map<String, Object> params) {
JdbcCursorItemReader<DynaBean> databaseReader;
databaseReader = new ByteDataBaseItemReaderFactory<>();
String jdbcDriver = params.containsKey("jdbc-driver") ? String.valueOf(params.get("jdbc-driver")): null;;
Assert.isTrue(jdbcDriver != null, "jdbc-driver is required!");
String username = params.containsKey("username") ? String.valueOf(params.get("username")): null;;
Assert.isTrue(username != null, "username is required!");
String password = params.containsKey("password") ? String.valueOf(params.get("password")): null;;
Assert.isTrue(password != null, "password is required!");
String jdbcURL = params.containsKey("jdbc-url") ? String.valueOf(params.get("jdbc-url")): null;;
Assert.isTrue(jdbcURL != null, "jdbc-url is required!");
String query = params.containsKey("query") ? String.valueOf(params.get("query")): null;;
Assert.isTrue(query != null, "query is required!");
DataSource dataSource = getBasicDataSource(jdbcDriver, username, password, jdbcURL);
databaseReader.setDataSource(dataSource);
databaseReader.setRowMapper(mapper);
databaseReader.setSql(query);
return databaseReader;
}
protected DataSource getBasicDataSource(String jdbcDriver, String username, String password, String jdbcURL) {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(jdbcDriver);
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setUrl(jdbcURL);
return dataSource;
}
}
package com.bytesw.bytebot.etl.batch.factory.reader;
import org.springframework.batch.item.ItemReader;
import java.util.Map;
public interface ItemReaderFactory<T, E> {
ItemReader<T> createReader(E mapper, Map<String, Object> params);
}
package com.bytesw.bytebot.etl.batch.listener;
import lombok.extern.log4j.Log4j2;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
@Log4j2
public class JobCompletionListener extends JobExecutionListenerSupport {
@Override
public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
log.debug("BATCH JOB COMPLETED SUCCESSFULLY");
}
}
}
\ No newline at end of file
package com.bytesw.bytebot.etl.batch.mapper;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.JdbcUtils;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class DynaBeanRowMapper<T> implements RowMapper<T> {
@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
DynaBean bean = new DynaBean();
int columnCount = rsmd.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
String column = JdbcUtils.lookupColumnName(rsmd, i);
bean.putIfAbsent(column, JdbcUtils.getResultSetValue(rs, i));
}
return (T) bean;
}
}
package com.bytesw.bytebot.etl.batch.processor;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import com.bytesw.bytebot.etl.beans.EventBean;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.batch.item.ItemProcessor;
public class ConvertToBeanProcessor implements ItemProcessor<DynaBean, DynaBean> {
private ObjectMapper mapper = new ObjectMapper();
@Override
public DynaBean process(DynaBean dynaBean) throws Exception {
Long id = new Long(String.valueOf(dynaBean.get("id")));
String data = (String) dynaBean.get("data");
String senderId = (String) dynaBean.get("sender_id");
EventBean eventBean = new EventBean();
eventBean.setId(id);
eventBean.setData(data);
eventBean.setSenderId(senderId);
dynaBean.put("bean", eventBean);
return dynaBean;
}
}
package com.bytesw.bytebot.etl.batch.service;
import com.bytesw.bytebot.etl.batch.beans.DBConfig;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
@Configuration
public class SchedulerConfiguration {
@Bean
public LockProvider lockProvider(DataSource dataSource) {
DBConfig dbConfig = new DBConfig();
dataSource = dbConfig.dataSource();
return new JdbcTemplateLockProvider(dataSource);
}
}
\ No newline at end of file
package com.bytesw.bytebot.etl.batch.writer;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import com.bytesw.bytebot.etl.beans.EventBean;
import com.bytesw.bytebot.etl.beans.ProcessMessageResult;
import com.bytesw.bytebot.etl.services.ProcessMessageService;
import com.bytesw.xdf.multitenant.core.ThreadLocalStorage;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.ItemWriter;
import javax.transaction.Transactional;
import java.util.List;
@Log4j2
public class ByteBotJPAWriter implements ItemWriter<DynaBean>, StepExecutionListener {
@Getter
@Setter
private ProcessMessageService service;
@Override
@Transactional
public void write(List<? extends DynaBean> list) throws Exception {
for (DynaBean dynaBean : list) {
EventBean eventBean = (EventBean) dynaBean.get("bean");
String json = (String) dynaBean.get("data");
ProcessMessageResult result = service.processMessage(json, eventBean.getSenderId());
log.debug(String.format("senderId: %s, processed: %s", eventBean.getSenderId(), result.isProcessed()));
service.saveHistory(eventBean.getId(), eventBean.getSenderId());
}
}
@Override
public void beforeStep(StepExecution stepExecution) {
String tenantId = stepExecution.getJobParameters().getString("tenantId");
ThreadLocalStorage.setTenantName(tenantId);
}
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
return stepExecution.getExitStatus();
}
}
package com.bytesw.bytebot.etl.batch.writer;
import com.bytesw.bytebot.etl.batch.beans.DeleteDataSensBean;
import com.bytesw.bytebot.etl.batch.beans.DeleteDataSensRegistryBean;
import com.bytesw.bytebot.etl.batch.beans.DynaBean;
import com.bytesw.bytebot.etl.dao.DeleteDataSensibleControlRepository;
import com.bytesw.bytebot.etl.dao.DeleteDataSensibleLogRepository;
import com.bytesw.bytebot.etl.dao.IntentRepository;
import com.bytesw.bytebot.etl.enums.EventTypeEnum;
import com.bytesw.bytebot.etl.model.DeleteDataSensibleControl;
import com.bytesw.bytebot.etl.model.DeleteDataSensibleLog;
import com.bytesw.bytebot.etl.model.Intent;
import com.bytesw.bytebot.etl.services.DeleteSensMessageService;
import com.bytesw.bytebot.etl.utils.JsonUtils;
import com.bytesw.xdf.exception.NotFoundException;
import com.bytesw.xdf.multitenant.core.ThreadLocalStorage;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.ItemWriter;
import javax.transaction.Transactional;
import java.sql.Timestamp;
import java.time.OffsetDateTime;
import java.util.*;
@Log4j2
public class DataSensibleJPAWriter implements ItemWriter<DynaBean>, StepExecutionListener {
@Getter
@Setter
private DeleteDataSensibleControlRepository deleteDataSensibleControlRepository;
@Getter
@Setter
private DeleteDataSensibleLogRepository deleteDataSensibleLogRepository;
@Getter
@Setter
private IntentRepository intentRepository;
@Getter
@Setter
private DeleteSensMessageService service;
@Getter
@Setter
private List<String> intentByAgent;
@Getter
@Setter
private DeleteDataSensBean agent;
@Override
@Transactional
public void write(List<? extends DynaBean> list) throws Exception {
Object numeros = JsonUtils.getFieldFromJson(agent.getChannelValue(), "$.telefono_despliegue");
List<String> numerosAgentes = numbersAgent((List<Map>) numeros);
for (DynaBean dynaBean : list) {
Long id = Long.parseLong(dynaBean.get("id").toString());
String json = (String) dynaBean.get("data");
String event = (String) JsonUtils.getFieldFromJson(json, "$.event");
String sender_id;
boolean update_control = false;
String presentDate = OffsetDateTime.now().toString().replace('T', ' ');
String timeZone = presentDate.substring(presentDate.length() - 6);
presentDate = presentDate.replace(timeZone, "");
if (EventTypeEnum.USER.getName().equals(event)) {
String toAgent = (String) JsonUtils.getFieldFromJson(json, "$.metadata.To");
String agentNumber = new String();
if (toAgent == null) {
continue;
}
if (!toAgent.isEmpty()) {
agentNumber = toAgent.split(":")[1];
}
if (numerosAgentes.contains(agentNumber)) {
String intent = (String) JsonUtils.getFieldFromJson(json, "$.parse_data.intent.name");
if (intentByAgent.contains(intent)) {
String SmSMessageSid = (String) JsonUtils.getFieldFromJson(json, "$.metadata.SmsMessageSid");
Optional<Intent> intenId = this.intentRepository.findIntenNameById(intent, agent.getAgenId());
if (!intenId.isPresent()) {
throw new Exception("Intent no esta presente");
}
try {
sender_id = (String) JsonUtils.getFieldFromJson(json, "$.sender_id");
log.info(sender_id);
} catch (Exception e) {
log.info(e.getMessage());
sender_id = (String) JsonUtils.getFieldFromJson(json, "$.metadata.sender_id");
}
List<DeleteDataSensRegistryBean> deleteSensibleBean = new ArrayList<>();
try {
deleteSensibleBean = service.deleteMessage(agent.getAgenId()
, SmSMessageSid, intenId.get().getId(), sender_id);
update_control = true;
} catch (NotFoundException e) {
update_control = true;
} catch (Exception e) {
update_control = false;
}
for (DeleteDataSensRegistryBean registry : deleteSensibleBean) {
DeleteDataSensibleLog reg = new DeleteDataSensibleLog();
reg.setIntenId(registry.getInten_id());
reg.setMessageId(registry.getMessage_sid());
reg.setMultimediaId(registry.getMultimedia_sid());
reg.setSendId(registry.getSender_id());
reg.setDate(Timestamp.valueOf(presentDate));
deleteDataSensibleLogRepository.save(reg);
}
}
}
} else {
update_control = true;
}
DeleteDataSensibleControl control = new DeleteDataSensibleControl();
Optional<DeleteDataSensibleControl> controlBd = deleteDataSensibleControlRepository.findEventIdByAgentId(agent.getAgenId());
if (update_control) {
if (controlBd.isPresent()) {
// Update
control.setId(controlBd.get().getId());
control.setAgentId(agent.getAgenId());
control.setEventId(id);
control.setDate(Timestamp.valueOf(presentDate));
deleteDataSensibleControlRepository.save(control);
} else {
// Create
control.setAgentId(agent.getAgenId());
control.setEventId(id);
control.setDate(Timestamp.valueOf(presentDate));
deleteDataSensibleControlRepository.save(control);
}
}
}
}
private List<String> numbersAgent(List<Map> listNumber){
List<String> result = new ArrayList<>();
for (Map map : listNumber){
String cod = (String) map.get("codigoInternacional");
String number = (String) map.get("numero");
String agent = "+" + cod + number;
result.add(agent);
}
return result;
}
@Override
public void beforeStep(StepExecution stepExecution) {
String tenantId = stepExecution.getJobParameters().getString("tenantId");
ThreadLocalStorage.setTenantName(tenantId);
}
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
return stepExecution.getExitStatus();
}
}
package com.bytesw.bytebot.etl.beans;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class ActionBean {
@Expose
private Long id;
@Expose
private String identifier;
}
package com.bytesw.bytebot.etl.beans;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
@Getter @Setter @ToString
public class EventBean implements Serializable {
private Long id;
private String data;
private String senderId;
}
package com.bytesw.bytebot.etl.beans;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class GoalBean {
@Expose
private Long id;
@Expose
private String identifier;
@Expose
private Long agenId;
}
\ No newline at end of file
package com.bytesw.bytebot.etl.beans;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class GoalForActionsBean {
@Expose
private Long id;
@Expose
private Long goalId;
@Expose
private Long actionId;
}
package com.bytesw.bytebot.etl.beans;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class IntentBean {
private Long id;
private String identifier;
private String sensible;
private Long agenId;
}
package com.bytesw.bytebot.etl.beans;
import lombok.Getter;
import lombok.Setter;
@Getter @Setter
public class ProcessMessageResult {
private boolean processed = true;
private String message;
}
package com.bytesw.bytebot.etl.beans;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp;
@Getter @Setter
public class SessionBean {
@Expose
private Long id;
@Expose
private Timestamp sessionDate;
@Expose
private Timestamp lastEventDate;
@Expose
private Timestamp responseDate;
@Expose
private Long userId;
@Expose
private Long channelId;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment