master
jkhong 2023-08-24 16:34:53 +09:00
commit cecef19c4a
89 changed files with 8188 additions and 0 deletions

31
.gitignore vendored 100644
View File

@ -0,0 +1,31 @@
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/

View File

@ -0,0 +1,117 @@
/*
* 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();
}
}

BIN
.mvn/wrapper/maven-wrapper.jar vendored 100644

Binary file not shown.

View File

@ -0,0 +1,2 @@
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

Binary file not shown.

BIN
lib/apptemplate.jar 100644

Binary file not shown.

Binary file not shown.

BIN
lib/comappblock.jar 100644

Binary file not shown.

BIN
lib/commons.jar 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/connection.jar 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/kvlists.jar 100644

Binary file not shown.

Binary file not shown.

BIN
lib/logging.jar 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/protocol.jar 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/system.jar 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

310
mvnw vendored 100644
View File

@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
mvnw.cmd vendored 100644
View File

@ -0,0 +1,182 @@
@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%

259
pom.xml 100644
View File

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>kr.co.i4way</groupId>
<artifactId>Gen_Web_API</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Gen_Web_API</name>
<description>Genesys Web Application</description>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.minidev/json-smart -->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.3</version>
</dependency>
<!-- Genesys Library -->
<dependency>
<groupId>apptemplate</groupId>
<artifactId>apptemplate</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/apptemplate.jar</systemPath>
</dependency>
<dependency>
<groupId>apptemplate-log4j2</groupId>
<artifactId>apptemplate-log4j2</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/apptemplate-log4j2.jar</systemPath>
</dependency>
<dependency>
<groupId>clusterprotocolappblock</groupId>
<artifactId>clusterprotocolappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/clusterprotocolappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>comappblock</groupId>
<artifactId>comappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/comappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>commons</groupId>
<artifactId>commons</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/commons.jar</systemPath>
</dependency>
<dependency>
<groupId>commonsappblock</groupId>
<artifactId>commonsappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/commonsappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>configurationprotocol</groupId>
<artifactId>configurationprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/configurationprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>connection</groupId>
<artifactId>connection</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/connection.jar</systemPath>
</dependency>
<dependency>
<groupId>contactsprotocol</groupId>
<artifactId>contactsprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/contactsprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>jackson2-module</groupId>
<artifactId>jackson2-module</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jackson2-module.jar</systemPath>
</dependency>
<dependency>
<groupId>kvlistbinding</groupId>
<artifactId>kvlistbinding</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/kvlistbinding.jar</systemPath>
</dependency>
<dependency>
<groupId>kvlists</groupId>
<artifactId>kvlists</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/kvlists.jar</systemPath>
</dependency>
<dependency>
<groupId>logging</groupId>
<artifactId>logging</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/logging.jar</systemPath>
</dependency>
<dependency>
<groupId>managementprotocol</groupId>
<artifactId>managementprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/managementprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>messagebrokerappblock</groupId>
<artifactId>messagebrokerappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/messagebrokerappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>netty-all-4.1.51.Final</groupId>
<artifactId>netty-all-4.1.51.Final</artifactId>
<version>4.1.51.Final</version>
<scope>system</scope>
<systemPath>${basedir}/lib/netty-all-4.1.51.Final.jar</systemPath>
</dependency>
<dependency>
<groupId>openmediaprotocol</groupId>
<artifactId>openmediaprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/openmediaprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>outboundprotocol</groupId>
<artifactId>outboundprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/outboundprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>protocol</groupId>
<artifactId>protocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/protocol.jar</systemPath>
</dependency>
<dependency>
<groupId>protocolmanagerappblock</groupId>
<artifactId>protocolmanagerappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/protocolmanagerappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>reportingprotocol</groupId>
<artifactId>reportingprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/reportingprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>routingprotocol</groupId>
<artifactId>routingprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/routingprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>system</groupId>
<artifactId>system</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/system.jar</systemPath>
</dependency>
<dependency>
<groupId>voiceprotocol</groupId>
<artifactId>voiceprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/voiceprotocol.jar</systemPath>
</dependency>
<dependency>
<groupId>warmstandbyappblock</groupId>
<artifactId>warmstandbyappblock</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/warmstandbyappblock.jar</systemPath>
</dependency>
<dependency>
<groupId>webmediaprotocol</groupId>
<artifactId>webmediaprotocol</artifactId>
<version>9.0.007</version>
<scope>system</scope>
<systemPath>${basedir}/lib/webmediaprotocol.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,40 @@
/*
package kr.co.i4way;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
//외장Tomcat 사용시
@SpringBootApplication
//@EnableScheduling
public class I4way_Service extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(I4way_Service.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(I4way_Service.class);
}
}
*/
/* 내장Tomcat 사용시*/
package kr.co.i4way;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
//@EnableScheduling
public class I4way_Service {
public static void main(String[] args) {
SpringApplication.run(I4way_Service.class, args);
}
}

View File

@ -0,0 +1,54 @@
package kr.co.i4way.common;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class CommandMap {
Map<String,Object> map = new HashMap<String,Object>();
public Object get(String key){
return map.get(key);
}
public void put(String key, Object value){
map.put(key, value);
}
public Object remove(String key){
return map.remove(key);
}
public boolean containsKey(String key){
return map.containsKey(key);
}
public boolean containsValue(Object value){
return map.containsValue(value);
}
public void clear(){
map.clear();
}
public Set<Entry<String, Object>> entrySet(){
return map.entrySet();
}
public Set<String> keySet(){
return map.keySet();
}
public boolean isEmpty(){
return map.isEmpty();
}
public void putAll(Map<? extends String, ?extends Object> m){
map.putAll(m);
}
public Map<String,Object> getMap(){
return map;
}
}

View File

@ -0,0 +1,74 @@
package kr.co.i4way.common.util;
import java.lang.reflect.Field;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
public class CipherAES {
static String AES_CBC_PKCS5Padding = "AES/CBC/PKCS5Padding";
static String MONITOR_KEY_VALUE = "BLUEQsiteUSE#MNS";
static String MONITOR_IV_VALUE = "SmartLOGIN201407";
private static String getKeyIvValue(String staticValue) throws Exception {
Class cipherAes = CipherAES.class;
Field cipherAesFields[] = cipherAes.getDeclaredFields();
String keyIvValue = "";
for (int i = 0; i < cipherAesFields.length; i++) {
if (staticValue.equals(cipherAesFields[i].getName())) {
keyIvValue = (String) cipherAesFields[i].get(cipherAes);
break;
}
}
return keyIvValue;
}
// Key 생성
public static SecretKey generateKey(String keyValue) throws Exception {
return new SecretKeySpec(keyValue.getBytes("UTF-8"), "AES");
}
// 복호화(String Decode)
public static String decrypt(String keyScn, String param) throws Exception {
System.out.println("keyScn==>"+keyScn);
System.out.println("param==>"+param);
return decrypt(AES_CBC_PKCS5Padding, param, getKeyIvValue(keyScn + "_KEY_VALUE"),
getKeyIvValue(keyScn + "_IV_VALUE"), "string");
}
// 복호화
public static String decrypt(String transType, String srcData, String keyValue, String ivValue, String encodeType)
throws Exception {
String result = "";
byte[] decData = null;
try {
SecretKey key = generateKey(keyValue);
Cipher cipher = Cipher.getInstance(transType);
if (transType.equals(AES_CBC_PKCS5Padding)) {
if (null != ivValue && ivValue.length() > 0) {
cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(ivValue.getBytes()));
} else {
cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(new byte[16]));
}
} else {
cipher.init(Cipher.DECRYPT_MODE, key);
}
decData = cipher.doFinal(Base64.decodeBase64(srcData));
result = new String(decData);
} catch (Exception e) {
result = "";
}
return result;
}
}

View File

@ -0,0 +1,117 @@
package kr.co.i4way.common.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
/**
* .
*
* @author someone
* @version 1.0.0
*/
public class JsonUtil {
/**
* Map json .
*
* @param map Map<String, Object>.
* @return JSONObject.
*/
public static JSONObject getJsonStringFromMap( Map<String, Object> map )
{
JSONObject jsonObject = new JSONObject();
for( Map.Entry<String, Object> entry : map.entrySet() ) {
String key = entry.getKey();
Object value = entry.getValue();
jsonObject.put(key, value);
}
return jsonObject;
}
/**
* List<Map> jsonArray .
*
* @param list List<Map<String, Object>>.
* @return JSONArray.
*/
public static JSONArray getJsonArrayFromList( List<Map<String, Object>> list )
{
JSONArray jsonArray = new JSONArray();
for( Map<String, Object> map : list ) {
jsonArray.add( getJsonStringFromMap( map ) );
}
return jsonArray;
}
/**
* List<Map> jsonString .
*
* @param list List<Map<String, Object>>.
* @return String.
*/
public static String getJsonStringFromList( List<Map<String, Object>> list )
{
JSONArray jsonArray = getJsonArrayFromList( list );
return jsonArray.toJSONString();
}
/**
* JsonObject Map<String, String> .
*
* @param jsonObj JSONObject.
* @return Map<String, Object>.
*/
@SuppressWarnings("unchecked")
public static Map<String, Object> getMapFromJsonObject( JSONObject jsonObj )
{
Map<String, Object> map = null;
try {
map = new ObjectMapper().readValue(jsonObj.toJSONString(), Map.class) ;
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return map;
}
/**
* JsonArray List<Map<String, String>> .
*
* @param jsonArray JSONArray.
* @return List<Map<String, Object>>.
*/
public static List<Map<String, Object>> getListMapFromJsonArray( JSONArray jsonArray )
{
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if( jsonArray != null )
{
int jsonSize = jsonArray.size();
for( int i = 0; i < jsonSize; i++ )
{
Map<String, Object> map = JsonUtil.getMapFromJsonObject( ( JSONObject ) jsonArray.get(i) );
list.add( map );
}
}
return list;
}
}

View File

@ -0,0 +1,532 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTreatment;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentGroupQuery;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
public class ConfigAgentGroup {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
ConfigPerson ps = null;
public ConfigAgentGroup(){
}
/**
* AgentGroup .
* @param service
* @param tenant_dbid
* @param group_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup getAgentGroupInfo(
final IConfService service,
int tenant_dbid,
String group_name
) {
CfgAgentGroup agentgroup = null;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setName(group_name);
agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return agentgroup;
}
/**
* AgentGroup .
* @param service
* @param tenant_dbid
* @param group_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup getAgentGroupInfo(
final IConfService service,
int tenant_dbid,
int group_dbid
) {
CfgAgentGroup agentgroup = null;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setDbid(group_dbid);
agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return agentgroup;
}
/**
* AgentGroup .
* @param iTenantDBID
* @param service
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Collection<CfgAgentGroup> getAgentGroupInfo(
final IConfService service,
int tenant_dbid
) {
Collection<CfgAgentGroup> agentgroups = null;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroups = service.retrieveMultipleObjects(CfgAgentGroup.class,
agentgroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return agentgroups;
}
/**
* AgentGroup Assign .
* @param service
* @param tenant_dbid
* @param person_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Collection<CfgAgentGroup> getAssignAgentGroup(
final IConfService service,
int tenant_dbid,
int person_dbid
) {
Collection<CfgAgentGroup> agentgroups = null;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setPersonDbid(person_dbid);
agentgroups = service.retrieveMultipleObjects(CfgAgentGroup.class,
agentgroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return agentgroups;
}
/**
* AgentGroup .
* @param service
* @param tenant_dbid
* @param group_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup createAgentGroup(
final IConfService service,
int tenant_dbid,
String group_name) {
CfgGroup group = new CfgGroup(service, null);
CfgAgentGroup cfggroup = null;
KeyValueCollection kvc = new KeyValueCollection();
try {
group.setTenantDBID(tenant_dbid);
group.setName(group_name);
kvc.addString("app", "true");
group.getUserProperties().addList("app", kvc);
//group.setUserProperties(kvc);
cfggroup = new CfgAgentGroup(service);
cfggroup.setGroupInfo(group);
//cfggroup.getGroupInfo().setUserProperties(kvc);
//KeyValuePair kv = new KeyValuePair("app", "true");
//cfggroup.setProperty("app", "true");
cfggroup.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return cfggroup;
}
/**
* AgentGroup
* @param service
* @param tenant_dbid
* @param group_dbid
* @param group_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup modifyAgentGroup(
final IConfService service,
int tenant_dbid,
int group_dbid,
String group_name) {
// Read configuration objects:
CfgAgentGroup agentgroup = null;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setDbid(group_dbid);
agentgroup = service.retrieveObject(CfgAgentGroup.class,agentgroupquery);
if(agentgroup != null){
agentgroup.getGroupInfo().setName(group_name);
agentgroup.save();
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return agentgroup;
}
/**
* AgentGroup .
* @param service
* @param tenant_dbid
* @param group_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Boolean deleteAgentGroup(
final IConfService service,
int tenant_dbid,
int group_dbid) {
Boolean rtnval = false;
try {
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setDbid(group_dbid);
CfgAgentGroup agentgroup = service.retrieveObject(CfgAgentGroup.class,agentgroupquery);
if(agentgroup != null){
agentgroup.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* AgentGroup Assign.
* @param service
* @param tenant_dbid
* @param group_name
* @param employee_ids
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup assignPersonToAgentGroup(
final IConfService service,
int tenant_dbid,
String group_name,
String employee_ids
) {
CfgAgentGroup agentgroup = null;
Collection<CfgPerson> rtn_persons = null;
CfgPerson rtn_person = null;
try{
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setName(group_name);
agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
String[] emps = employee_ids.split(",");
if(emps != null && emps.length > 0) {
ps = new ConfigPerson();
if(agentgroup != null){
if(agentgroup.getAgentDBIDs() != null){
for(int i=0; i<emps.length; i++){
rtn_person = null;
rtn_person = ps.getPersonInfo(service, tenant_dbid, "emp", emps[i]);
agentgroup.getAgentDBIDs().add(rtn_person.getDBID());
}
}else{
rtn_persons = new HashSet<CfgPerson>();
for(int i=0; i<emps.length; i++){
rtn_person = null;
rtn_person = ps.getPersonInfo(service, tenant_dbid, "emp", emps[i]);
if(rtn_person != null) {
rtn_persons.add(rtn_person);
}
}
agentgroup.setAgents(rtn_persons);
}
}
}
agentgroup.save();
}catch(ConfigException ex){
logger.error("ConfigException", ex);
}
return agentgroup;
}
/**
* AgentGroup Assign.
* @param service
* @param tenant_dbid
* @param group_dbid
* @param person_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup assignPersonToAgentGroup(
final IConfService service,
int tenant_dbid,
int group_dbid,
int person_dbid
) {
Boolean rtnval = false;
Collection<CfgPerson> rtn_persons = null;
CfgAgentGroup agentgroup = null;
try{
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setDbid(group_dbid);
agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
if(agentgroup != null){
if(agentgroup.getAgentDBIDs() != null){
logger.info("null아님");
agentgroup.getAgentDBIDs().add(person_dbid);
}else{
logger.info("null임");
rtn_persons = ps.getPersonInfo(service, tenant_dbid, person_dbid);
agentgroup.setAgents(rtn_persons);
}
agentgroup.save();
}
}catch(ConfigException ex){
logger.error("ConfigException", ex);
}
return agentgroup;
}
/**
* AgentGroup Assign .
* @param service
* @param tenant_dbid
* @param group_dbid
* @param person_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup removePersonFromAgentGroup(
final IConfService service,
int tenant_dbid,
String group_name,
String employee_ids
){
Boolean rtnval = false;
CfgPerson person = null;
CfgAgentGroup agentgroup = null;
try{
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setName(group_name);
agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
String[] emps = employee_ids.split(",");
if(agentgroup != null){
ps = new ConfigPerson();
for(int i=0; i<emps.length; i++){
person = null;
person = ps.getPersonInfo(service, tenant_dbid, "emp", emps[i]);
if(agentgroup.getAgentDBIDs() != null) {
agentgroup.getAgentDBIDs().remove(person.getDBID());
}else {
System.out.println("Agent Is Null");
}
}
agentgroup.save();
}
}catch(ConfigException ex){
logger.error("ConfigException", ex);
}
return agentgroup;
}
/**
* Source AgentGroup Person Target AgentGroup .
* @param service
* @param tenant_dbid
* @param source_group_name
* @param target_group_name
* @param delete_yn
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup movePerson(
final IConfService service,
int tenant_dbid,
String source_group_name,
String target_group_name,
String delete_yn
){
Boolean rtnval = false;
CfgAgentGroup s_agentgroup = null;
CfgAgentGroup t_agentgroup = null;
try{
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setName(source_group_name);
s_agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
agentgroupquery.setName(target_group_name);
t_agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
if(s_agentgroup != null) {
if(s_agentgroup.getAgentDBIDs() != null) {
if(t_agentgroup != null) {
if(t_agentgroup.getAgentDBIDs() != null) {
for(int dbid : s_agentgroup.getAgentDBIDs()) {
t_agentgroup.getAgentDBIDs().add(dbid);
}
}else {
t_agentgroup.setAgents(s_agentgroup.getAgents());
}
t_agentgroup.save();
if(delete_yn.equals("Y")) {
Collection<CfgPerson> rtnpersons = new HashSet<CfgPerson>();
s_agentgroup.setAgents(rtnpersons);
s_agentgroup.save();
}
}
}
}
}catch(ConfigException ex){
logger.error("ConfigException", ex);
}
return t_agentgroup;
}
/**
* Source AgentGroup Person Target AgentGroup .
* @param service
* @param tenant_dbid
* @param source_group_name
* @param target_group_name
* @param employee_ids
* @param delete_yn
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentGroup movePerson2(
final IConfService service,
int tenant_dbid,
String source_group_name,
String target_group_name,
String employee_ids,
String delete_yn
){
Boolean rtnval = false;
CfgAgentGroup s_agentgroup = null;
CfgAgentGroup t_agentgroup = null;
Collection<CfgPerson> rtn_persons = null;
try{
CfgAgentGroupQuery agentgroupquery = new CfgAgentGroupQuery();
agentgroupquery.setTenantDbid(tenant_dbid);
agentgroupquery.setName(source_group_name);
s_agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
agentgroupquery.setName(target_group_name);
t_agentgroup = service.retrieveObject(CfgAgentGroup.class, agentgroupquery);
String[] emps = employee_ids.split(",");
if(s_agentgroup != null) {
if(s_agentgroup.getAgentDBIDs() != null) {
if(t_agentgroup != null) {
if(emps != null && emps.length > 0) {
if(t_agentgroup.getAgentDBIDs() != null) { //Person이 있을때 (있는거에 add)
for(CfgPerson person : s_agentgroup.getAgents()) {
for(int i=0; i<emps.length; i++) {
if(person.getEmployeeID().equals(emps[i])) {
t_agentgroup.getAgentDBIDs().add(person.getDBID());
}
}
}
}else { //Person이 없을때(Collection만들어서 setAgent)
rtn_persons = new HashSet<CfgPerson>();
for(CfgPerson person : s_agentgroup.getAgents()) {
for(int i=0; i<emps.length; i++) {
if(person.getEmployeeID().equals(emps[i])) { //상담그룹의 상담사 목록에 emps가 있으면
rtn_persons.add(person);
}
}
}
t_agentgroup.setAgents(rtn_persons);
}
}else {
if(t_agentgroup.getAgentDBIDs() != null) { //Person이 있을때 (있는거에 add)
for(int dbid : s_agentgroup.getAgentDBIDs()) {
t_agentgroup.getAgentDBIDs().add(dbid);
}
}else { //Person이 없을때(Collection만들어서 setAgent)
t_agentgroup.setAgents(s_agentgroup.getAgents());
}
}
t_agentgroup.save();
if(delete_yn.equals("Y")) {
Collection<CfgPerson> delpersons = s_agentgroup.getAgents();
if(delpersons != null) {
if(rtn_persons != null) {
for(CfgPerson ps : rtn_persons) {
delpersons.remove(ps);
}
}else {
delpersons = new HashSet<CfgPerson>();
}
}else {
delpersons = new HashSet<CfgPerson>();
}
s_agentgroup.setAgents(delpersons);
s_agentgroup.save();
}
}
}
}
}catch(ConfigException ex){
logger.error("ConfigException", ex);
}
return t_agentgroup;
}
}

View File

@ -0,0 +1,246 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentLoginQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
public class ConfigAgentLogin {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ConfigAgentLogin() {
}
/**
* employee_id Person Assign AgentLogin .
* @param service
* @param tenant_dbid
* @param employee_id
* @return
*/
public Collection<CfgAgentLoginInfo> getAgentLoginInfo(final IConfService service, int tenant_dbid, String employee_id){
CfgPerson tmpCfgPerson = null;
Collection<CfgAgentLoginInfo> rtnAgentLoginInfo = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setTenantDbid(tenant_dbid);
personquery.setEmployeeId(employee_id);
try {
tmpCfgPerson = service.retrieveObject(CfgPerson.class, personquery);
if(tmpCfgPerson != null) {
rtnAgentLoginInfo = tmpCfgPerson.getAgentInfo().getAgentLogins();
}
}catch (ConfigException e) {
e.printStackTrace();
}
return rtnAgentLoginInfo;
}
/**
* AgentLogin .(multi)
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param assignable
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Collection<CfgAgentLogin> getAgentLogins(
final IConfService service, int tenant_dbid, int switch_dbid, String assignable)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgAgentLoginQuery agentloginquery = new CfgAgentLoginQuery();
agentloginquery.setTenantDbid(tenant_dbid);
agentloginquery.setSwitchDbid(switch_dbid);
if(assignable.equals("yes")) {
agentloginquery.setNoPersonDbid(2);
}
Collection<CfgAgentLogin> agentlogin = null;
agentlogin = service.retrieveMultipleObjects(CfgAgentLogin.class,
agentloginquery);
return agentlogin;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return CfgAgentLogin
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentLogin getAgentLogin(
final IConfService service, int tenant_dbid, int switch_dbid, String login_code
)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgAgentLogin agentlogin = null;
CfgAgentLoginQuery agentloginquery = new CfgAgentLoginQuery();
agentloginquery.setTenantDbid(tenant_dbid);
agentloginquery.setSwitchDbid(switch_dbid);
agentloginquery.setLoginCode(login_code);
agentlogin = service.retrieveObject(CfgAgentLogin.class, agentloginquery);
return agentlogin;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param agentLogin_dbid
* @return CfgAgentLogin
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentLogin getAgentLogin(
final IConfService service,
int tenant_dbid,
int switch_dbid,
int agentLogin_dbid
)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgAgentLogin agentlogin = null;
CfgAgentLoginQuery agentloginquery = new CfgAgentLoginQuery();
agentloginquery.setTenantDbid(tenant_dbid);
agentloginquery.setSwitchDbid(switch_dbid);
agentloginquery.setDbid(agentLogin_dbid);
agentlogin = service.retrieveObject(CfgAgentLogin.class, agentloginquery);
return agentlogin;
}
/**
* AgentLogin Assign .
* @param loginDBID
* @param service
* @return true : Assign , false : Assign.
* @throws ConfigException
* @throws InterruptedException
*/
public boolean checkAssignYn(IConfService service,
int tenant_dbid,
int switch_dbid,
String login_code
)
throws ConfigException, InterruptedException {
boolean rtnval = false;
String warpuptm = "";
CfgAgentLoginQuery loginquery = new CfgAgentLoginQuery();
loginquery.setTenantDbid(tenant_dbid);
loginquery.setSwitchDbid(switch_dbid);
loginquery.setLoginCode(login_code);
loginquery.setNoPersonDbid(2);
CfgAgentLogin agentlogin = null;
agentlogin = service.retrieveObject(CfgAgentLogin.class,loginquery);
if(agentlogin != null){
KeyValueCollection appOptions = agentlogin.getUserProperties();
for(Object selectionObj : appOptions){
KeyValuePair sectionKvp = (KeyValuePair) selectionObj;
for (Object recordObj : sectionKvp.getTKVValue()) {
KeyValuePair recordKvp = (KeyValuePair) recordObj;
if(recordKvp.getStringKey().equals("wrap-up-time")){
warpuptm = recordKvp.getStringValue();
//logger.info("wrap-up-time=" + warpuptm);
}
}
}
if(warpuptm.equals("")){
rtnval = true;
}else{
rtnval = false;
}
}
return rtnval;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @param switch_folder_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgAgentLogin createAgentLogin(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String login_code
)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgAgentLogin agentlogin = new CfgAgentLogin(service);
agentlogin.setTenantDBID(tenant_dbid);
agentlogin.setSwitchDBID(switch_dbid);
agentlogin.setLoginCode(login_code);
agentlogin.setSwitchSpecificType(1);
agentlogin.save();
return agentlogin;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteAgentLogins(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String login_code
)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgAgentLogin agentlogin = null;
boolean rtnbool = false;
try{
CfgAgentLoginQuery agentloginquery = new CfgAgentLoginQuery();
agentloginquery.setTenantDbid(tenant_dbid);
agentloginquery.setSwitchDbid(switch_dbid);
agentloginquery.setLoginCode(login_code);
agentlogin = service.retrieveObject(CfgAgentLogin.class,agentloginquery);
agentlogin.delete();
rtnbool = true;
}catch(Exception e){
rtnbool = false;
}
return rtnbool;
}
}

View File

@ -0,0 +1,295 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingList;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingListInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgFilter;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTableAccess;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTreatment;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCallingListQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTableAccessQuery;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.configuration.protocol.types.CfgDialMode;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectType;
import com.genesyslab.platform.configuration.protocol.types.CfgOperationMode;
import com.genesyslab.platform.configuration.protocol.types.CfgOptimizationMethod;
public class ConfigCallingList {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
ConfigPerson ps = null;
ConfigOB ob = null;
public ConfigCallingList(){
}
/**
* CallingList .
* @param service
* @param tenant_dbid
* @param callinglist_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCallingList getCallingList(
final IConfService service,
int tenant_dbid,
String callinglist_name
) {
CfgCallingList callinglist = null;
try {
CfgCallingListQuery callinglistquery = new CfgCallingListQuery();
callinglistquery.setTenantDbid(tenant_dbid);
callinglistquery.setName(callinglist_name);
callinglist = service.retrieveObject(CfgCallingList.class, callinglistquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return callinglist;
}
/**
* CallingList .
* @param service
* @param tenant_dbid
* @param callinglist_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCallingList getCallingList(
final IConfService service,
int tenant_dbid,
int callinglist_dbid
) {
CfgCallingList callinglist = null;
try {
CfgCallingListQuery callinglistquery = new CfgCallingListQuery();
callinglistquery.setTenantDbid(tenant_dbid);
callinglistquery.setDbid(callinglist_dbid);
callinglist = service.retrieveObject(CfgCallingList.class, callinglistquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return callinglist;
}
/**
* CallingList .
* @param iTenantDBID
* @param service
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Collection<CfgCallingList> getCallingList(
final IConfService service,
int tenant_dbid
) {
Collection<CfgCallingList> callinglist = null;
try {
CfgCallingListQuery callinglistquery = new CfgCallingListQuery();
callinglistquery.setTenantDbid(tenant_dbid);
callinglist = service.retrieveMultipleObjects(CfgCallingList.class, callinglistquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return callinglist;
}
/**
* CallingList .
* @param service
* @param tenant_dbid
* @param calinglist_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public int deleteCallingList(
final IConfService service,
int tenant_dbid,
String calinglist_name
)
throws ConfigException, InterruptedException {
// Read configuration objects:
int returnval = 0;
CfgCallingList callinglist = getCallingList(service, tenant_dbid, calinglist_name);
if(callinglist != null) {
callinglist.delete();
returnval = 1;
}
return returnval;
}
/**
* CallingList .
* @param service
* @param tenant_dbid
* @param calinglist_name
* @param table_name
* @param filter_name
* @param maximum
* @param treatment_names
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCallingList modifyCallingList(
final IConfService service,
int tenant_dbid,
String calinglist_name,
String table_name,
String filter_name,
int maximum,
String treatment_names
)
throws ConfigException, InterruptedException {
// Read configuration objects:
String[] arr_treatment = treatment_names.split(",");
Collection<CfgTreatment> treatments = new HashSet<CfgTreatment>();
CfgCallingList callinglist = getCallingList(service, tenant_dbid, calinglist_name);
ob = new ConfigOB();
CfgTreatment tmptreatment = null;
if(arr_treatment.length > 0) {
for(int i=0; i<arr_treatment.length; i++) {
tmptreatment = null;
tmptreatment = ob.getTreatment(service, tenant_dbid, arr_treatment[i]);
treatments.add(tmptreatment);
}
}
CfgTableAccess ta = getTableAccess(service, tenant_dbid, table_name);
CfgFilter filter = ob.getFilter(service, tenant_dbid, filter_name);
callinglist.setTableAccess(ta);
callinglist.setTreatments(treatments);
//callinglist.setFilterDBID(filter.getDBID());
callinglist.setMaxAttempts(maximum);
callinglist.save();
return callinglist;
}
/**
* CallingList .
* @param service
* @param tenant_dbid
* @param calinglist_name
* @param table_name
* @param filter_name
* @param maximum
* @param treatment_names
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCallingList createCallingList(
final IConfService service,
int tenant_dbid,
String calinglist_name,
String table_name,
String filter_name,
int maximum,
String treatment_names
)
throws ConfigException, InterruptedException {
// Read configuration objects:
String[] arr_treatment = treatment_names.split(",");
Collection<CfgTreatment> treatments = new HashSet<CfgTreatment>();
CfgCallingList callinglist = new CfgCallingList(service);
callinglist.setTenantDBID(tenant_dbid);
callinglist.setName(calinglist_name);
ob = new ConfigOB();
CfgTreatment tmptreatment = null;
if(arr_treatment.length > 0) {
for(int i=0; i<arr_treatment.length; i++) {
tmptreatment = null;
tmptreatment = ob.getTreatment(service, tenant_dbid, arr_treatment[i]);
treatments.add(tmptreatment);
}
}
callinglist.setName(calinglist_name);
CfgTableAccess ta = getTableAccess(service, tenant_dbid, table_name);
CfgFilter filter = ob.getFilter(service, tenant_dbid, filter_name);
callinglist.setTableAccess(ta);
callinglist.setTreatments(treatments);
//callinglist.setFilterDBID(filter.getDBID());
callinglist.setMaxAttempts(maximum);
callinglist.save();
return callinglist;
}
/**
* callinglustinfo Collection .
* @param service
* @param tenant_dbid
* @param cl
* @return
*/
public Collection<CfgCallingListInfo> createCallingListInfo(final IConfService service,
int tenant_dbid,
CfgCallingList cl
) {
Collection<CfgCallingListInfo> cmp = null;
CfgCallingListInfo newcli = null;
try {
newcli = new CfgCallingListInfo(service, null);
cmp = new HashSet<CfgCallingListInfo>();
newcli.setIsActive(CfgFlag.CFGTrue);
newcli.setShare(10);
newcli.setCallingList(cl);
cmp.add(newcli);
} catch (Exception e) {
logger.error("ConfigException", e);
}
return cmp;
}
/**
* TableAccess .
* @param service
* @param tenant_dbid
* @param ta_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgTableAccess getTableAccess(
final IConfService service,
int tenant_dbid,
String ta_name
) {
CfgTableAccess tableaccess = null;
try {
CfgTableAccessQuery taquery = new CfgTableAccessQuery();
taquery.setTenantDbid(tenant_dbid);
taquery.setName(ta_name);
tableaccess = service.retrieveObject(CfgTableAccess.class, taquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return tableaccess;
}
}

View File

@ -0,0 +1,195 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingList;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingListInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroupInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkill;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTreatment;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTreatmentQuery;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
public class ConfigCampaign {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
private ConfigCampaignGroup configcampaigngroup = null;
public ConfigCampaign() {
}
public Collection<CfgCampaign> getCampaignInfo(final IConfService service, int tenant_dbid) {
Collection<CfgCampaign> rtnCampaign = null;
CfgCampaignQuery campaignquery = new CfgCampaignQuery();
campaignquery.setTenantDbid(tenant_dbid);
try {
rtnCampaign = service.retrieveMultipleObjects(CfgCampaign.class, campaignquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtnCampaign;
}
public CfgCampaign getCampaignInfo(final IConfService service, int tenant_dbid, String campaign_name) {
CfgCampaign rtnCampaign = null;
CfgCampaignQuery campaignquery = new CfgCampaignQuery();
campaignquery.setTenantDbid(tenant_dbid);
campaignquery.setName(campaign_name);
try {
rtnCampaign = service.retrieveObject(CfgCampaign.class, campaignquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnCampaign;
}
public CfgCampaign getCampaignInfo(final IConfService service, int tenant_dbid, int campaign_dbid) {
CfgCampaign rtnCampaign = null;
CfgCampaignQuery campaignquery = new CfgCampaignQuery();
campaignquery.setTenantDbid(tenant_dbid);
campaignquery.setDbid(campaign_dbid);
try {
rtnCampaign = service.retrieveObject(CfgCampaign.class, campaignquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnCampaign;
}
/**
* Campaign .
* @param service
* @param campaign_name
* @param group_name
* @param callinglist_name
* @param vdn
* @return
*/
public CfgCampaign createCampaign(
final IConfService service,
int tenant_dbid,
String campaign_name,
Collection<CfgCallingListInfo> callinglist) {
CfgCampaign campaign = null;
Collection<CfgCampaignGroupInfo> campaigngroups = null;
configcampaigngroup = new ConfigCampaignGroup();
try{
// Read configuration objects:
campaign = new CfgCampaign(service);
campaign.setTenantDBID(tenant_dbid);
campaign.setName(campaign_name);
campaign.setState(CfgObjectState.CFGEnabled);
campaign.setCallingLists(callinglist);
campaign.save();
}catch (Exception e) {
e.printStackTrace();
}
return campaign;
}
/**
* campaign .
* @param service
* @param tenant_dbid
* @param campaign_dbid
* @param campaign_name
* @param callinglist
* @return
*/
public CfgCampaign modifyCampaign(
final IConfService service,
int tenant_dbid,
int campaign_dbid,
String campaign_name,
String campaign_state,
Collection<CfgCallingListInfo> callinglist){
// Read configuration objects:
CfgCampaign campaign = null;
CfgCampaignQuery campaignquery = new CfgCampaignQuery();
try {
campaignquery.setTenantDbid(tenant_dbid);
campaignquery.setDbid(campaign_dbid);
campaign = service.retrieveObject(CfgCampaign.class,campaignquery);
campaign.setCallingLists(callinglist);
campaign.setState(CfgObjectState.valueOf(campaign_state));
campaign.save();
}catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return campaign;
}
/**
* campaign .
* @param service
* @param tenant_dbid
* @param campaign_dbid
* @return
*/
public boolean deleteCampaign(
final IConfService service,
int tenant_dbid,
int campaign_dbid){
// Read configuration objects:
CfgCampaign campaign = null;
CfgCampaignQuery campaignquery = new CfgCampaignQuery();
boolean rtnbool = false;
try {
campaignquery.setTenantDbid(tenant_dbid);
campaignquery.setDbid(campaign_dbid);
campaign = service.retrieveObject(CfgCampaign.class,campaignquery);
campaign.delete();
rtnbool = true;
}catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnbool;
}
public Collection<CfgTreatment> getTreatments(final IConfService service, int tenant_dbid) {
Collection<CfgTreatment> treatment = null;
CfgTreatmentQuery treatmentquery = new CfgTreatmentQuery();
treatmentquery.setTenantDbid(tenant_dbid);
try {
treatment = service.retrieveMultipleObjects(CfgTreatment.class, treatmentquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return treatment;
}
public CfgTreatment getTreatment(final IConfService service, int tenant_dbid, String treatment_name) {
CfgTreatment treatment = null;
CfgTreatmentQuery treatmentquery = new CfgTreatmentQuery();
treatmentquery.setTenantDbid(tenant_dbid);
treatmentquery.setName(treatment_name);
try {
treatment = service.retrieveObject(CfgTreatment.class, treatmentquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return treatment;
}
}

View File

@ -0,0 +1,260 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.ICfgQuery;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroupInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignGroupQuery;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.configuration.protocol.types.CfgDialMode;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectType;
import com.genesyslab.platform.configuration.protocol.types.CfgOperationMode;
import com.genesyslab.platform.configuration.protocol.types.CfgOptimizationMethod;
public class ConfigCampaignGroup {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
ConfigPerson ps = null;
ConfigAgentGroup ag = null;
public ConfigCampaignGroup(){
}
/**
* CampaignGroup .
* @param service
* @param tenant_dbid
* @param group_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCampaignGroup getCampaignGroup(
final IConfService service,
int tenant_dbid,
String group_name
) {
CfgCampaignGroup campaigngroup = null;
try {
CfgCampaignGroupQuery campaigngroupquery = new CfgCampaignGroupQuery();
campaigngroupquery.setTenantDbid(tenant_dbid);
campaigngroupquery.setName(group_name);
campaigngroup = service.retrieveObject(CfgCampaignGroup.class, campaigngroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return campaigngroup;
}
/**
* CampaignGroup .
* @param service
* @param tenant_dbid
* @param group_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgCampaignGroup getCampaignGroup(
final IConfService service,
int tenant_dbid,
int group_dbid
) {
CfgCampaignGroup campaigngroup = null;
try {
CfgCampaignGroupQuery campaigngroupquery = new CfgCampaignGroupQuery();
campaigngroupquery.setTenantDbid(tenant_dbid);
campaigngroupquery.setDbid(group_dbid);
campaigngroup = service.retrieveObject(CfgCampaignGroup.class, campaigngroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return campaigngroup;
}
/**
* CampaignGroup .
* @param iTenantDBID
* @param service
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public Collection<CfgCampaignGroup> getCampaignGroup(
final IConfService service,
int tenant_dbid
) {
Collection<CfgCampaignGroup> campaigngroup = null;
try {
CfgCampaignGroupQuery campaigngroupquery = new CfgCampaignGroupQuery();
campaigngroupquery.setTenantDbid(tenant_dbid);
campaigngroup = service.retrieveMultipleObjects(CfgCampaignGroup.class,
campaigngroupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return campaigngroup;
}
// /**
// * CampaignGroup을 조회한다.
// * @param service
// * @param tenant_dbid
// * @param group_name
// * @return
// * @throws ConfigException
// * @throws InterruptedException
// */
// public Collection<CfgCampaignGroupInfo> getCampaignGroupInfo(
// final IConfService service,
// int tenant_dbid,
// String group_name
// ) {
// Collection<CfgCampaignGroupInfo> campaigngroup = null;
// try {
// CfgCampaignGroupInfo bbb = null;
// CfgCampaignGroup aa = null;
// aa.
//// CfgCamp
////
//// CfgCampaignGroupQuery campaigngroupquery = new CfgCampaignGroupQuery();
//// campaigngroupquery.setTenantDbid(tenant_dbid);
//// campaigngroupquery.setName(group_name);
// campaigngroup = service.retrieveMultipleObjects(CfgCampaignGroupInfo.class);
// } catch (ConfigException e) {
// logger.error("ConfigException", e);
// }catch (InterruptedException e) {
// logger.error("InterruptedException", e);
// }
// return campaigngroup;
// }
/**
* .
* @param service
* @param tenant_dbid
* @param group_name
* @param campaign_name
* @param obj_type(CFGAgentGroup, CFGPlaceGroup)
* @param dialmode(CFGDMPower, CFGDMPredict, CFGDMPreview, CFGDMProgress)
* @param opmode(CFGOMMaxOperationMode, CFGOMNoOperationMode, CFGOMSchedule)
* @param optmode(CFGOMBusyFactor, CFGOMDistributionTime, CFGOMMaximumGain, CFGOMMaxOptimizationMethod, CFGOMNoOptimizationMethod, CFGOMOverdialRate, CFGOMWaitTime)
* @return
*/
public CfgCampaignGroup createCampaignGroup(final IConfService service,
int tenant_dbid,
String group_name,
String obj_type,
CfgCampaign cm,
String dialmode,
String opmode,
String optmode,
int ocs_dbid,
int min_rec_buff_size,
int rec_buff_size,
int num_channel,
int method_value
) {
CfgCampaignGroup cmp = new CfgCampaignGroup(service);
ag = new ConfigAgentGroup();
try {
CfgAgentGroup agentgroup = ag.getAgentGroupInfo(service, tenant_dbid, group_name);
Collection<Integer> server = new HashSet<Integer>();
if(agentgroup != null) {
cmp.setName(cm.getName() + "@" + group_name);
cmp.setCampaignDBID(cm.getDBID());
cmp.setGroupDBID(agentgroup.getDBID());
cmp.setGroupType(CfgObjectType.valueOf(obj_type));
cmp.setDialMode(CfgDialMode.valueOf(dialmode));
cmp.setOperationMode(CfgOperationMode.valueOf(opmode));
cmp.setOptMethod(CfgOptimizationMethod.valueOf(optmode));
server.add(ocs_dbid);
cmp.setServerDBIDs(server);
cmp.setMinRecBuffSize(min_rec_buff_size);
cmp.setOptRecBuffSize(rec_buff_size);
cmp.setNumOfChannels(num_channel);
cmp.setOptMethodValue(method_value);
cmp.save();
}else {
logger.info("agentGroup is null");
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return cmp;
}
/**
* .
* @param service
* @param tenant_dbid
* @param group_name
* @param campaign_name
* @param obj_type(CFGAgentGroup, CFGPlaceGroup)
* @param dialmode(CFGDMPower, CFGDMPredict, CFGDMPreview, CFGDMProgress)
* @param opmode(CFGOMMaxOperationMode, CFGOMNoOperationMode, CFGOMSchedule)
* @param optmode(CFGOMBusyFactor, CFGOMDistributionTime, CFGOMMaximumGain, CFGOMMaxOptimizationMethod, CFGOMNoOptimizationMethod, CFGOMOverdialRate, CFGOMWaitTime)
* @return
*/
public CfgCampaignGroup modifyCampaignGroup(final IConfService service,
int tenant_dbid,
CfgCampaignGroup campaigngroup,
String group_name,
String obj_type,
CfgCampaign cm,
String dialmode,
String opmode,
String optmode,
int ocs_dbid,
int min_rec_buff_size,
int rec_buff_size,
int num_channel,
int method_value
) {
CfgAgentGroup agentgroup = null;
ag = new ConfigAgentGroup();
try {
agentgroup = ag.getAgentGroupInfo(service, tenant_dbid, group_name);
Collection<Integer> server = new HashSet<Integer>();
if(agentgroup != null) {
campaigngroup.setName(cm.getName() + "@" + group_name);
campaigngroup.setGroupDBID(agentgroup.getDBID());
campaigngroup.setGroupType(CfgObjectType.valueOf(obj_type));
campaigngroup.setDialMode(CfgDialMode.valueOf(dialmode));
campaigngroup.setOperationMode(CfgOperationMode.valueOf(opmode));
campaigngroup.setOptMethod(CfgOptimizationMethod.valueOf(optmode));
server.add(ocs_dbid);
campaigngroup.setServerDBIDs(server);
campaigngroup.setMinRecBuffSize(min_rec_buff_size);
campaigngroup.setOptRecBuffSize(rec_buff_size);
campaigngroup.setNumOfChannels(num_channel);
campaigngroup.setOptMethodValue(method_value);
campaigngroup.save();
}else {
logger.info("agentGroup is null");
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return campaigngroup;
}
}

View File

@ -0,0 +1,375 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingList;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingListInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroupInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkill;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSwitch;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTransaction;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentLoginQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgDNGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgDNQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgSwitchQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTransactionQuery;
import com.genesyslab.platform.configuration.protocol.metadata.CfgTypeMask;
import com.genesyslab.platform.configuration.protocol.types.CfgDNGroupType;
import com.genesyslab.platform.configuration.protocol.types.CfgDNType;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
import com.genesyslab.platform.configuration.protocol.types.CfgRouteType;
public class ConfigDn {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ConfigDn() {
}
/**
* CfgDN .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgDN> getDn(final IConfService service, int tenant_dbid, int switch_dbid) {
Collection<CfgDN> rtndn = null;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
try {
rtndn = service.retrieveMultipleObjects(CfgDN.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtndn;
}
/**
* CfgSwitch .
* @param service
* @param tenant_dbid
* @param switch_name
* @return
*/
public CfgSwitch getSwitch(final IConfService service, int tenant_dbid, String switch_name) {
CfgSwitch rtnswitch = null;
CfgSwitchQuery switchquery = new CfgSwitchQuery();
switchquery.setTenantDbid(tenant_dbid);
switchquery.setName(switch_name);
try {
rtnswitch = service.retrieveObject(CfgSwitch.class, switchquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnswitch;
}
/**
* CfgDN .
* @param service
* @param tenant_dbid
* @param dn_name
* @return
*/
public CfgDN getDn(final IConfService service, int tenant_dbid, int switch_dbid, String dn_name) {
CfgDN rtndn = null;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDnNumber(dn_name);
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDN .
* @param service
* @param tenant_dbid
* @param dn_name
* @return
*/
public CfgTransaction gettr(final IConfService service, int tenant_dbid, int switch_dbid, String tr_name) {
CfgTransaction rtndn = null;
CfgTransactionQuery dnquery = new CfgTransactionQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setName(tr_name);
try {
rtndn = service.retrieveObject(CfgTransaction.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDN .
* @param service
* @param tenant_dbid
* @param dn_dbid
* @return
*/
public CfgDN getDn(final IConfService service, int tenant_dbid, int switch_dbid, int dn_dbid) {
CfgDN rtndn = null;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDbid(dn_dbid);
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* DN .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param number
* @param dn_type
* @param route_type
* @param switch_spec_type
* @return
*/
public CfgDN createDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String number,
String dn_type,
String route_type,
int switch_spec_type
) {
// Read configuration objects:
CfgDN new_dn = new CfgDN(service);
try {
new_dn.setTenantDBID(tenant_dbid);
new_dn.setNumber(number);
new_dn.setSwitchDBID(switch_dbid);
new_dn.setState(CfgObjectState.CFGEnabled);
new_dn.setType(CfgDNType.valueOf(dn_type));
new_dn.setRouteType(CfgRouteType.valueOf(route_type));
new_dn.setSwitchSpecificType(switch_spec_type);
new_dn.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return new_dn;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String dn_name
) {
CfgDN rtndn = null;
boolean rtnval = false;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setSwitchDbid(switch_dbid);
dnquery.setDnNumber(dn_name);
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
if(rtndn != null) {
rtndn.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String dn_name,
String dn_type
) {
CfgDN rtndn = null;
boolean rtnval = false;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDnNumber(dn_name);
dnquery.setDnType(CfgDNType.valueOf(dn_type));
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
if(rtndn != null) {
rtndn.delete();
rtnval = false;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgDNGroup> getDnGroup(final IConfService service, int tenant_dbid) {
Collection<CfgDNGroup> rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
try {
rtndn = service.retrieveMultipleObjects(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @return
*/
public CfgDNGroup getDnGroup(final IConfService service, int tenant_dbid, String gorup_name) {
CfgDNGroup rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setName(gorup_name);
try {
rtndn = service.retrieveObject(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param group_dbid
* @return
*/
public CfgDNGroup getDnGroup(final IConfService service, int tenant_dbid, int group_dbid) {
CfgDNGroup rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDbid(group_dbid);
try {
rtndn = service.retrieveObject(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @param dngroup_type
* @return
*/
public CfgDNGroup createDNGroup(
final IConfService service,
int tenant_dbid,
String gorup_name,
String dngroup_type
) {
// Read configuration objects:
CfgDNGroup new_group = new CfgDNGroup(service);
try {
CfgGroup groupinfo = new CfgGroup(service, null);
groupinfo.setName(gorup_name);
groupinfo.setTenantDBID(tenant_dbid);
new_group.setGroupInfo(groupinfo);
new_group.setType(CfgDNGroupType.valueOf(dngroup_type));
new_group.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return new_group;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDNGroup(
final IConfService service,
int tenant_dbid,
String gorup_name
) {
CfgDNGroup group = null;
boolean rtnval = false;
try {
group = getDnGroup(service, tenant_dbid, gorup_name);
if(group != null) {
group.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
}

View File

@ -0,0 +1,297 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingList;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingListInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroupInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgFolder;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkill;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSwitch;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTransaction;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentLoginQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgDNGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgDNQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgFolderQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgSwitchQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTransactionQuery;
import com.genesyslab.platform.configuration.protocol.metadata.CfgTypeMask;
import com.genesyslab.platform.configuration.protocol.types.CfgDNGroupType;
import com.genesyslab.platform.configuration.protocol.types.CfgDNType;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
import com.genesyslab.platform.configuration.protocol.types.CfgRouteType;
public class ConfigFolder {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ConfigFolder() {
}
/**
* CfgFolder .
* @param service
* @param owner_type
* @param folder_dbid
* @return
*/
public CfgFolder getFolderInfo(final IConfService service, int owner_type, int folder_dbid) {
CfgFolder rtnfolder = null;
CfgFolderQuery folderquery = new CfgFolderQuery();
folderquery.setOwnerType(owner_type);
folderquery.setDbid(folder_dbid);
try {
rtnfolder = service.retrieveObject(CfgFolder.class, folderquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnfolder;
}
/**
* DN .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param number
* @param dn_type
* @param route_type
* @param switch_spec_type
* @return
*/
public CfgDN createDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String number,
String dn_type,
String route_type,
int switch_spec_type
) {
// Read configuration objects:
CfgDN new_dn = new CfgDN(service);
try {
new_dn.setTenantDBID(tenant_dbid);
new_dn.setNumber(number);
new_dn.setSwitchDBID(switch_dbid);
new_dn.setState(CfgObjectState.CFGEnabled);
new_dn.setType(CfgDNType.valueOf(dn_type));
new_dn.setRouteType(CfgRouteType.valueOf(route_type));
new_dn.setSwitchSpecificType(switch_spec_type);
new_dn.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return new_dn;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String dn_name
) {
CfgDN rtndn = null;
boolean rtnval = false;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setSwitchDbid(switch_dbid);
dnquery.setDnNumber(dn_name);
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
if(rtndn != null) {
rtndn.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* AgentLogin .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param login_code
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDN(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String dn_name,
String dn_type
) {
CfgDN rtndn = null;
boolean rtnval = false;
CfgDNQuery dnquery = new CfgDNQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDnNumber(dn_name);
dnquery.setDnType(CfgDNType.valueOf(dn_type));
try {
rtndn = service.retrieveObject(CfgDN.class, dnquery);
if(rtndn != null) {
rtndn.delete();
rtnval = false;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgDNGroup> getDnGroup(final IConfService service, int tenant_dbid) {
Collection<CfgDNGroup> rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
try {
rtndn = service.retrieveMultipleObjects(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @return
*/
public CfgDNGroup getDnGroup(final IConfService service, int tenant_dbid, String gorup_name) {
CfgDNGroup rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setName(gorup_name);
try {
rtndn = service.retrieveObject(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param group_dbid
* @return
*/
public CfgDNGroup getDnGroup(final IConfService service, int tenant_dbid, int group_dbid) {
CfgDNGroup rtndn = null;
CfgDNGroupQuery dnquery = new CfgDNGroupQuery();
dnquery.setTenantDbid(tenant_dbid);
dnquery.setDbid(group_dbid);
try {
rtndn = service.retrieveObject(CfgDNGroup.class, dnquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtndn;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @param dngroup_type
* @return
*/
public CfgDNGroup createDNGroup(
final IConfService service,
int tenant_dbid,
String gorup_name,
String dngroup_type
) {
// Read configuration objects:
CfgDNGroup new_group = new CfgDNGroup(service);
try {
CfgGroup groupinfo = new CfgGroup(service, null);
groupinfo.setName(gorup_name);
groupinfo.setTenantDBID(tenant_dbid);
new_group.setGroupInfo(groupinfo);
new_group.setType(CfgDNGroupType.valueOf(dngroup_type));
new_group.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return new_group;
}
/**
* CfgDNGroup .
* @param service
* @param tenant_dbid
* @param gorup_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deleteDNGroup(
final IConfService service,
int tenant_dbid,
String gorup_name
) {
CfgDNGroup group = null;
boolean rtnval = false;
try {
group = getDnGroup(service, tenant_dbid, gorup_name);
if(group != null) {
group.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
}

View File

@ -0,0 +1,258 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingList;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCallingListInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaignGroupInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgFilter;
import com.genesyslab.platform.applicationblocks.com.objects.CfgFormat;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkill;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTransaction;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTreatment;
import com.genesyslab.platform.applicationblocks.com.queries.CfgAgentLoginQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgCampaignQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgDNQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgFilterQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgFormatQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTransactionQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTreatmentQuery;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.configuration.protocol.types.CfgDNType;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
import com.genesyslab.platform.configuration.protocol.types.CfgRouteType;
public class ConfigOB {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ConfigOB() {
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgFilter> getFilter(final IConfService service, int tenant_dbid) {
Collection<CfgFilter> rtnfilter = null;
CfgFilterQuery fquery = new CfgFilterQuery();
fquery.setTenantDbid(tenant_dbid);
try {
rtnfilter = service.retrieveMultipleObjects(CfgFilter.class, fquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtnfilter;
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @param filter_name
* @return
*/
public CfgFilter getFilter(final IConfService service, int tenant_dbid, String filter_name) {
CfgFilter rtnfilter = null;
CfgFilterQuery fquery = new CfgFilterQuery();
fquery.setTenantDbid(tenant_dbid);
fquery.setName(filter_name);
try {
rtnfilter = service.retrieveObject(CfgFilter.class, fquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnfilter;
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @param filter_dbid
* @return
*/
public CfgFilter getFilter(final IConfService service, int tenant_dbid, int filter_dbid) {
CfgFilter rtnfilter = null;
CfgFilterQuery fquery = new CfgFilterQuery();
fquery.setTenantDbid(tenant_dbid);
fquery.setDbid(filter_dbid);
try {
rtnfilter = service.retrieveObject(CfgFilter.class, fquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnfilter;
}
/**
* CfgFormat .
* @param service
* @param tenant_dbid
* @param format_name
* @return
*/
public CfgFormat getFormat(final IConfService service, int tenant_dbid, String format_name) {
CfgFormat rtnformat = null;
CfgFormatQuery fquery = new CfgFormatQuery();
fquery.setTenantDbid(tenant_dbid);
fquery.setName(format_name);
try {
rtnformat = service.retrieveObject(CfgFormat.class, fquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnformat;
}
/**
* CfgTreatment .
* @param service
* @param tenant_dbid
* @param treatment_name
* @return
*/
public CfgTreatment getTreatment(final IConfService service, int tenant_dbid, String treatment_name) {
CfgTreatment rtnTreatment = null;
CfgTreatmentQuery tquery = new CfgTreatmentQuery();
tquery.setTenantDbid(tenant_dbid);
tquery.setName(treatment_name);
try {
rtnTreatment = service.retrieveObject(CfgTreatment.class, tquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnTreatment;
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @param filter_name
* @param format_name
* @param criteria
* @param orderby
* @return
*/
public CfgFilter createFilter(
final IConfService service,
int tenant_dbid,
String filter_name,
String format_name,
String criteria,
String orderby
) {
// Read configuration objects:
CfgFilter new_filter = new CfgFilter(service);
CfgFormat format = null;
try {
new_filter.setTenantDBID(tenant_dbid);
new_filter.setName(filter_name);
KeyValueCollection mainSection = new KeyValueCollection();
KeyValueCollection defaultSection = new KeyValueCollection();
if (criteria != null)
defaultSection.addString("criteria", criteria);
if (orderby != null)
defaultSection.addString("order_by", orderby);
mainSection.addObject("default", defaultSection);
new_filter.setUserProperties(mainSection);
format = getFormat(service, tenant_dbid, format_name);
new_filter.setFormat(format);
new_filter.save();
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new_filter;
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @param filter_name
* @param format_name
* @param criteria
* @param orderby
* @return
*/
public CfgFilter modifyFilter(
final IConfService service,
int tenant_dbid,
String filter_name,
String criteria,
String orderby
) {
// Read configuration objects:
CfgFilter filter = getFilter(service, tenant_dbid, filter_name);
try {
KeyValueCollection mainSection = new KeyValueCollection();
KeyValueCollection defaultSection = new KeyValueCollection();
if (criteria != null)
defaultSection.addString("criteria", criteria);
if (orderby != null)
defaultSection.addString("order_by", orderby);
mainSection.addObject("default", defaultSection);
filter.setUserProperties(mainSection);
filter.save();
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return filter;
}
/**
* CfgFilter .
* @param service
* @param tenant_dbid
* @param filter_name
* @return
*/
public int deleteFilter(
final IConfService service,
int tenant_dbid,
String filter_name
) {
int returnval = 0;
CfgFilter filter = getFilter(service, tenant_dbid, filter_name);
try {
if(filter != null) {
filter.delete();
returnval = 1;
}
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return returnval;
}
}

View File

@ -0,0 +1,474 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkill;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPersonQuery;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import com.genesyslab.platform.configuration.protocol.types.CfgObjectState;
public class ConfigPerson {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ConfigPerson() {
}
public CfgPerson getPersonInfo(final IConfService service, int tenant_dbid, String qyery_type, String query_string) {
CfgPerson rtnCfgPerson = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setTenantDbid(tenant_dbid);
if(qyery_type.equals("usr")) {
personquery.setUserName(query_string);
}else if(qyery_type.equals("emp")) {
personquery.setEmployeeId(query_string);
}
try {
rtnCfgPerson = service.retrieveObject(CfgPerson.class, personquery);
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnCfgPerson;
}
public CfgPerson getPersonInfo_single(final IConfService service, int tenant_dbid, int person_dbid) {
CfgPerson rtnCfgPerson = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setTenantDbid(tenant_dbid);
personquery.setDbid(person_dbid);
try {
rtnCfgPerson = service.retrieveObject(CfgPerson.class, personquery);
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnCfgPerson;
}
public Collection<CfgPerson> getPersonInfo(final IConfService service, int tenant_dbid, int person_dbid) {
Collection<CfgPerson> rtnpersons = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setTenantDbid(tenant_dbid);
personquery.setDbid(person_dbid);
try {
rtnpersons = service.retrieveMultipleObjects(CfgPerson.class, personquery);
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnpersons;
}
public Collection<CfgPerson> getPersonInfo(final IConfService service, int tenant_dbid) {
Collection<CfgPerson> rtnpersons = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setIsAgent(2);
personquery.setTenantDbid(tenant_dbid);
try {
rtnpersons = service.retrieveMultipleObjects(CfgPerson.class, personquery);
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnpersons;
}
public Collection<CfgPerson> getPersonInfo(final IConfService service, int tenant_dbid, int skill_dbid, int skill_level) {
Collection<CfgPerson> rtnpersons = new HashSet<CfgPerson>();
Collection<CfgPerson> tmppersons = null;
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setIsAgent(2);
personquery.setTenantDbid(tenant_dbid);
personquery.setSkillDbid(skill_dbid);
try {
tmppersons = service.retrieveMultipleObjects(CfgPerson.class, personquery);
for (CfgPerson person : tmppersons){
Collection<CfgSkillLevel> skill_levels = person.getAgentInfo().getSkillLevels();
boolean chklevel = false;
for (CfgSkillLevel skilllevel : skill_levels){
if(skilllevel.getLevel() == skill_level) {
chklevel = true;
}
}
if(chklevel) {
rtnpersons.add(person);
}
}
} catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtnpersons;
}
/**
* Person .
* @param service
* @param tenant_dbid
* @param first_name
* @param last_name
* @param employee_id
* @param user_name
* @param folder_dbid
* @return
*/
public CfgPerson createPerson(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String first_name,
String last_name,
String employee_id,
String user_name,
int folder_dbid) {
CfgPerson person = null;
try{
// Read configuration objects:
person = new CfgPerson(service);
person.setTenantDBID(tenant_dbid);
person.setFirstName(first_name);
person.setLastName(last_name);
person.setEmployeeID(employee_id);
person.setUserName(user_name);
person.setIsAgent(CfgFlag.CFGTrue);
if(folder_dbid != 0) {
person.setFolderId(folder_dbid);
}
person.save();
if(person != null) {
if(setAgentLoginToPerson(service, person, tenant_dbid, switch_dbid, employee_id)) {
person = getPersonInfo(service, tenant_dbid, "emp", employee_id);
}
}
}catch (ConfigException e) {
e.printStackTrace();
}
return person;
}
/**
* Person .
* @param service
* @param person
* @param first_name
* @param last_name
* @param employee_id
* @param user_name
* @return
*/
public CfgPerson modifyPerson(
final IConfService service,
CfgPerson person,
String first_name,
String last_name,
String employee_id,
String user_name){
// Read configuration objects:
try {
person.setFirstName(first_name);
person.setLastName(last_name);
person.setUserName(user_name);
person.save();
}catch (ConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return person;
}
/**
* Person .
* @param service
* @param tenant_dbid
* @param person_dbid
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deletePerson(
final IConfService service,
int tenant_dbid,
int person_dbid
)
throws ConfigException, InterruptedException {
// Read configuration objects:
CfgPerson person = null;
boolean rtnbool = false;
try{
CfgPersonQuery personquery = new CfgPersonQuery();
personquery.setTenantDbid(tenant_dbid);
personquery.setDbid(person_dbid);
person = service.retrieveObject(CfgPerson.class,personquery);
person.delete();
rtnbool = true;
}catch(Exception e){
rtnbool = false;
}
return rtnbool;
}
/**
* Person .
* @param service
* @param person
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deletePerson(
final IConfService service,
CfgPerson person
)
throws ConfigException, InterruptedException {
boolean rtnbool = false;
try{
person.delete();
rtnbool = true;
}catch(Exception e){
rtnbool = false;
}
return rtnbool;
}
/**
* Person .
* @param service
* @param person Person
* @param flag (true = Enabled, false = Disabled)
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgPerson setPersonState(
final IConfService service,
CfgPerson person,
boolean flag
)
throws ConfigException, InterruptedException {
// Read configuration objects:
if(flag){
person.setState(CfgObjectState.CFGEnabled);
}else{
person.setState(CfgObjectState.CFGDisabled);
}
person.save();
return person;
}
/**
* Person AgentLogin Assign.
* @param service
* @param person
* @param tenant_dbid
* @param switch_dbid
* @param employee_id
* @return
*/
public boolean setAgentLoginToPerson(
final IConfService service,
CfgPerson person,
int tenant_dbid,
int switch_dbid,
String employee_id) {
ConfigAgentLogin configagentlogin = new ConfigAgentLogin();
boolean assignyn = false;
boolean rtnResult = false;
try {
CfgAgentLogin agentlogin = configagentlogin.getAgentLogin(service, tenant_dbid, switch_dbid, employee_id);
if(agentlogin == null) {
agentlogin = configagentlogin.createAgentLogin(service, tenant_dbid, switch_dbid, employee_id);
assignyn = true;
}else {
assignyn = configagentlogin.checkAssignYn(service, tenant_dbid, switch_dbid, employee_id);
}
System.out.println(assignyn);
//AgentLoginId가 Assign된 상태가 아니면(assignyn true이면 Assign가능)
if(assignyn) {
CfgAgentLoginInfo logininfo = new CfgAgentLoginInfo(service, null);
logininfo.setAgentLoginDBID(agentlogin.getDBID());
logininfo.setAgentLogin(agentlogin);
logininfo.setWrapupTime(0);
person.getAgentInfo().getAgentLogins().add(logininfo);
person.save();
rtnResult = true;
}
}catch (ConfigException e) {
rtnResult = false;
e.printStackTrace();
}catch ( InterruptedException e) {
rtnResult = false;
e.printStackTrace();
}
return rtnResult;
}
/**
* Person Assign AgentLoginID .
* @param service
* @param person
* @param tenant_dbid
* @param switch_dbid
* @param employee_id
* @return
*/
public boolean removeAgentLoginToPerson(
final IConfService service,
CfgPerson person,
int tenant_dbid,
int switch_dbid,
String employee_id) {
boolean deleteYn = false;
try {
Collection<CfgAgentLoginInfo> agentlogininfo = person.getAgentInfo().getAgentLogins(); //기존 AgentLogin정보
Collection<CfgAgentLoginInfo> newinfoAgentLoginInfos = new HashSet<CfgAgentLoginInfo>(); //새로운 AgentLogin정보
Iterator<CfgAgentLoginInfo> iter = agentlogininfo.iterator();
while (iter.hasNext()) {
CfgAgentLoginInfo cfgagentlogininfo = iter.next();
if(!cfgagentlogininfo.getAgentLogin().getLoginCode().equals(employee_id)) {
newinfoAgentLoginInfos.add(cfgagentlogininfo);
}
}
person.getAgentInfo().getAgentLogins().clear();
person.getAgentInfo().setAgentLogins(newinfoAgentLoginInfos);
person.save();
deleteYn = true;
}catch (ConfigException e) {
deleteYn = false;
e.printStackTrace();
}
return deleteYn;
}
/**
* PersonSkill Assign.
* @param service
* @param personobj
* @param skill_dbids
* @param skill_levels
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean setSkillsToPerson(
final IConfService service,
CfgPerson personobj,
String[] skill_dbids,
String[] skill_levels)
throws ConfigException, InterruptedException {
boolean rtnbool = false;
try{
Collection<CfgSkillLevel> skill = new HashSet<CfgSkillLevel>();
if(skill_dbids != null && skill_levels != null) {
for(int i=0; i<skill_dbids.length; i++) {
CfgSkillLevel li = new CfgSkillLevel(service, null);
li.setSkillDBID(Integer.parseInt(skill_dbids[i]));
li.setLevel(Integer.parseInt(skill_levels[i]));
skill.add(li);
}
personobj.getAgentInfo().setSkillLevels(skill);
personobj.save();
rtnbool = true;
}
}catch(Exception e){
rtnbool = false;
}
return rtnbool;
}
/**
* Person Skill
* @param service
* @param person
* @param skill_dbids
* @param skill_levels
* @return
*/
public boolean removeSkillsToPerson(
final IConfService service,
CfgPerson person,
String[] skill_dbids,
String[] skill_levels) {
boolean deleteYn = false;
try {
if(person.getAgentInfo().getSkillLevels() != null){
Collection<CfgSkillLevel> cfgSkillLevel = null;
Collection<CfgSkillLevel> tmpSkillLevel = new HashSet<CfgSkillLevel>();
cfgSkillLevel = person.getAgentInfo().getSkillLevels();
tmpSkillLevel.addAll(cfgSkillLevel);
if(cfgSkillLevel.size() > 0){
for(CfgSkillLevel lvl : cfgSkillLevel){
for(int i=0; i<skill_dbids.length; i++){
if(lvl.getSkillDBID().equals(Integer.parseInt(skill_dbids[i]))){
if(lvl.getLevel().equals(Integer.parseInt(skill_levels[i]))){
tmpSkillLevel.remove(lvl);
}
}
}
}
person.getAgentInfo().setSkillLevels(tmpSkillLevel);
person.save();
deleteYn = true;
}
}
}catch (ConfigException e) {
deleteYn = false;
e.printStackTrace();
}
return deleteYn;
}
/**
* Person Skill .
* @param service
* @param person
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean removeAllSkillsToPerson(
final IConfService service,
CfgPerson person) {
boolean rtnbool = false;
try{
person.getAgentInfo().getSkillLevels().clear();
person.save();
rtnbool = true;
}catch (ConfigException e) {
rtnbool = false;
e.printStackTrace();
}
return rtnbool;
}
}

View File

@ -0,0 +1,285 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import java.util.HashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPlace;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPlaceGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTransaction;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPlaceGroupQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgPlaceQuery;
import com.genesyslab.platform.applicationblocks.com.queries.CfgTransactionQuery;
import com.genesyslab.platform.configuration.protocol.types.CfgDNGroupType;
public class ConfigPlace {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
private ConfigDn configdn = null;
public ConfigPlace() {
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgPlace> getPlace(final IConfService service, int tenant_dbid) {
Collection<CfgPlace> rtnplace = null;
CfgPlaceQuery placequery = new CfgPlaceQuery();
placequery.setTenantDbid(tenant_dbid);
try {
rtnplace = service.retrieveMultipleObjects(CfgPlace.class, placequery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtnplace;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param place_name
* @return
*/
public CfgPlace getPlace(final IConfService service, int tenant_dbid, String place_name) {
CfgPlace rtnplace = null;
CfgPlaceQuery placequery = new CfgPlaceQuery();
placequery.setTenantDbid(tenant_dbid);
placequery.setName(place_name);
try {
rtnplace = service.retrieveObject(CfgPlace.class, placequery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnplace;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param place_dbid
* @return
*/
public CfgPlace getPlace(final IConfService service, int tenant_dbid, int place_dbid) {
CfgPlace rtnplace = null;
CfgPlaceQuery placequery = new CfgPlaceQuery();
placequery.setTenantDbid(tenant_dbid);
placequery.setDbid(place_dbid);
try {
rtnplace = service.retrieveObject(CfgPlace.class, placequery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnplace;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param place_name
* @param dn
* @return
*/
public CfgPlace createPlace(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String place_name,
String[] dn
) {
CfgPlace new_place = new CfgPlace(service);
configdn = new ConfigDn();
CfgDN tmpdn = null;
Collection<CfgDN> dns = new HashSet<CfgDN>();
try {
new_place.setTenantDBID(tenant_dbid);
new_place.setName(place_name);
if(dn.length > 0) {
for(int i=0; i<dn.length;i++) {
tmpdn = null;
tmpdn = configdn.getDn(service, tenant_dbid, switch_dbid, dn[i]);
dns.add(tmpdn);
new_place.setDNs(dns);
}
}
new_place.save();
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return new_place;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param switch_dbid
* @param old_place_name
* @param new_place_name
* @param dn
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public CfgPlace modifyPlace(
final IConfService service,
int tenant_dbid,
int switch_dbid,
String old_place_name,
String new_place_name,
String[] dn
) {
CfgPlace place = null;
boolean rtnval = false;
configdn = new ConfigDn();
CfgDN tmpdn = null;
Collection<CfgDN> dns = new HashSet<CfgDN>();
try {
place = getPlace(service, tenant_dbid, old_place_name);
if(place != null) {
place.setName(new_place_name);
if(dn.length > 0) {
for(int i=0; i<dn.length;i++) {
tmpdn = null;
tmpdn = configdn.getDn(service, tenant_dbid, switch_dbid, dn[i]);
dns.add(tmpdn);
place.setDNs(dns);
}
}
place.save();
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return place;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param place_name
* @return
* @throws ConfigException
* @throws InterruptedException
*/
public boolean deletePlace(
final IConfService service,
int tenant_dbid,
String place_name
) {
CfgPlace place = null;
boolean rtnval = false;
try {
place = getPlace(service, tenant_dbid, place_name);
if(place != null) {
place.delete();
rtnval = true;
}
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnval;
}
/**
* CfgPlace Transaction .
* @param service
* @param tenant_dbid
* @param place_name
* @return
*/
public CfgTransaction getTr(final IConfService service, int tenant_dbid, int switch_dbid, String place_name) {
CfgTransaction rtnplace = null;
CfgTransactionQuery placequery = new CfgTransactionQuery();
placequery.setTenantDbid(tenant_dbid);
placequery.setName(place_name);
try {
rtnplace = service.retrieveObject(CfgTransaction.class, placequery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnplace;
}
/**
* CfgPlaceGroup .
* @param service
* @param tenant_dbid
* @return
*/
public Collection<CfgPlaceGroup> getPlaceGroup(final IConfService service, int tenant_dbid) {
Collection<CfgPlaceGroup> rtnplacegroup = null;
CfgPlaceGroupQuery placequery = new CfgPlaceGroupQuery();
placequery.setTenantDbid(tenant_dbid);
try {
rtnplacegroup = service.retrieveMultipleObjects(CfgPlaceGroup.class, placequery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
} catch (InterruptedException e) {
logger.error("InterruptedException", e);
}
return rtnplacegroup;
}
/**
* CfgPlaceGroup .
* @param service
* @param tenant_dbid
* @param place_name
* @return
*/
public CfgPlaceGroup getPlaceGroup(final IConfService service, int tenant_dbid, String group_name) {
CfgPlaceGroup rtnplacegroup = null;
CfgPlaceGroupQuery groupquery = new CfgPlaceGroupQuery();
groupquery.setTenantDbid(tenant_dbid);
groupquery.setName(group_name);
try {
rtnplacegroup = service.retrieveObject(CfgPlaceGroup.class, groupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnplacegroup;
}
/**
* CfgPlace .
* @param service
* @param tenant_dbid
* @param place_dbid
* @return
*/
public CfgPlaceGroup getPlaceGroup(final IConfService service, int tenant_dbid, int place_dbid) {
CfgPlaceGroup rtnplacegroup = null;
CfgPlaceGroupQuery groupquery = new CfgPlaceGroupQuery();
groupquery.setTenantDbid(tenant_dbid);
groupquery.setDbid(place_dbid);
try {
rtnplacegroup = service.retrieveObject(CfgPlaceGroup.class, groupquery);
} catch (ConfigException e) {
logger.error("ConfigException", e);
}
return rtnplacegroup;
}
}

View File

@ -0,0 +1,454 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genesyslab.platform.applicationblocks.com.CfgObject;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgCampaign;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.applicationblocks.com.objects.CfgTransaction;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
public class ManageUserProperties {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
public ManageUserProperties() {
}
public JSONObject getUserProperties(CfgTransaction obj) {
KeyValueCollection kv = null;
JSONObject jsonObj = new JSONObject();
JSONObject jsonObj2 = new JSONObject();
JSONObject rtnObj = new JSONObject();
String opt_name = null;
kv = obj.getUserProperties();
if(kv != null) {
for(Object selObj : kv) {
opt_name = "";
KeyValuePair sectionKvp = (KeyValuePair) selObj;
opt_name = sectionKvp.getStringKey();
jsonObj = new JSONObject();
for (Object recordObj : sectionKvp.getTKVValue()) {
KeyValuePair recordKvp = (KeyValuePair) recordObj;
jsonObj.put(recordKvp.getStringKey(), recordKvp.getStringValue());
}
jsonObj2.put(opt_name, jsonObj);
}
rtnObj.put("Sections", jsonObj2);
}
//System.out.println(rtnObj.toJSONString());
return rtnObj;
}
public CfgAgentGroup setUserProperties(CfgAgentGroup obj, String sec_name, String[] k, String[] v) {
KeyValueCollection obj_kv = null;
KeyValueCollection insert_kv = null;
String opt_name = null;
boolean update_flag = false;
KeyValuePair sectionKvp = null;
KeyValuePair tmpkvp = null;
try {
obj_kv = obj.getGroupInfo().getUserProperties();
if(obj_kv != null && obj_kv.length() > 0) {
for(Object selObj : obj_kv) {
opt_name = "";
sectionKvp = (KeyValuePair) selObj;
opt_name = sectionKvp.getStringKey();
if(sec_name.equals(opt_name)) {
logger.info("update mode");
update_flag = true;
break;
}else {
logger.info("insert mode1");
}
}
if(!update_flag) {
insert_kv = new KeyValueCollection();
for(int i=0; i<k.length; i++) {
insert_kv.addString(k[i], v[i]);
}
tmpkvp = new KeyValuePair(sec_name, insert_kv);
obj_kv.addPair(tmpkvp);
obj.getGroupInfo().setUserProperties(obj_kv);
obj.save();
}else {
if(sectionKvp != null) {
if(sec_name.equals(opt_name)) {
insert_kv = new KeyValueCollection();
KeyValueCollection tmp_kv = sectionKvp.getTKVValue();
for(int i=0; i<k.length; i++) {
boolean ck = false;
for(Object tmpObj : tmp_kv) {
KeyValuePair kvp = (KeyValuePair) tmpObj;
if(k[i].equals(kvp.getStringKey())){
ck = true;
}
}
if(ck) {
logger.info("지우고 추가해 " + "key=" + k[i] + ", value=" + v[i]);
tmp_kv.remove(k[i]);
tmp_kv.addString(k[i], v[i]);
}else {
logger.info("추가해 " + "key=" + k[i] + ", value=" + v[i]);
tmp_kv.addString(k[i], v[i]);
}
}
tmpkvp = new KeyValuePair(sec_name, tmp_kv);
obj_kv.remove(sec_name);
obj_kv.addPair(tmpkvp);
obj.getGroupInfo().setUserProperties(obj_kv);
obj.save();
}
}
}
}else {
logger.info("insert mode2");
insert_kv = new KeyValueCollection();
logger.info("K의 길이는 " + k.length);
for(int i=0; i<k.length; i++) {
logger.info("insert key="+k[i] + ", value=" + v[i]);
insert_kv.addString(k[i], v[i]);
}
tmpkvp = new KeyValuePair(sec_name, insert_kv);
obj_kv = new KeyValueCollection();
obj_kv.addPair(tmpkvp);
obj.getGroupInfo().setUserProperties(obj_kv);
obj.save();
}
}catch(Exception e) {
logger.error("Exception", e);
}
return obj;
}
public CfgAgentGroup removeUserProperties(CfgAgentGroup obj, String sec_name, String[] k, String[] v) {
KeyValueCollection obj_kv = null;
KeyValueCollection insert_kv = null;
String opt_name = null;
boolean update_flag = false;
KeyValuePair sectionKvp = null;
KeyValuePair tmpkvp = null;
try {
obj_kv = obj.getGroupInfo().getUserProperties();
if(obj_kv != null && obj_kv.length() > 0) {
for(Object selObj : obj_kv) {
opt_name = "";
sectionKvp = (KeyValuePair) selObj;
opt_name = sectionKvp.getStringKey();
KeyValueCollection tmp_kv = sectionKvp.getTKVValue();
if(sec_name.equals(opt_name)) {
if(k != null && k.length > 0) {
if(sectionKvp != null) {
if(sec_name.equals(opt_name)) {
insert_kv = new KeyValueCollection();
for(int i=0; i<k.length; i++) {
boolean ck = false;
for(Object tmpObj : tmp_kv) {
KeyValuePair kvp = (KeyValuePair) tmpObj;
if(k[i].equals(kvp.getStringKey())){
ck = true;
}
}
if(ck) {
logger.info("지워 " + "key=" + k[i] + ", value=" + v[i]);
tmp_kv.remove(k[i]);
}
}
tmpkvp = new KeyValuePair(sec_name, tmp_kv);
obj_kv.remove(sec_name);
obj_kv.addPair(tmpkvp);
obj.getGroupInfo().setUserProperties(obj_kv);
obj.save();
}
}
}else {
obj_kv.remove(sec_name);
obj.getGroupInfo().setUserProperties(obj_kv);
obj.save();
}
break;
}
}
// if(!update_flag) {
// insert_kv = new KeyValueCollection();
// for(int i=0; i<k.length; i++) {
// insert_kv.addString(k[i], v[i]);
// }
// tmpkvp = new KeyValuePair(sec_name, insert_kv);
// obj_kv.addPair(tmpkvp);
// obj.getGroupInfo().setUserProperties(obj_kv);
// obj.save();
// }else {
// if(sectionKvp != null) {
// if(sec_name.equals(opt_name)) {
// insert_kv = new KeyValueCollection();
// KeyValueCollection tmp_kv = sectionKvp.getTKVValue();
// for(int i=0; i<k.length; i++) {
// boolean ck = false;
// for(Object tmpObj : tmp_kv) {
// KeyValuePair kvp = (KeyValuePair) tmpObj;
// if(k[i].equals(kvp.getStringKey())){
// ck = true;
// }
// }
// if(ck) {
// logger.info("지우고 추가해 " + "key=" + k[i] + ", value=" + v[i]);
// tmp_kv.remove(k[i]);
// tmp_kv.addString(k[i], v[i]);
// }else {
// logger.info("추가해 " + "key=" + k[i] + ", value=" + v[i]);
// tmp_kv.addString(k[i], v[i]);
// }
// }
// tmpkvp = new KeyValuePair(sec_name, tmp_kv);
// obj_kv.remove(sec_name);
// obj_kv.addPair(tmpkvp);
// obj.getGroupInfo().setUserProperties(obj_kv);
// obj.save();
// }
// }
// }
}
}catch(Exception e) {
logger.error("Exception", e);
}
return obj;
}
// public CfgTransaction setUserProperties(CfgTransaction obj, String sec_name, String[] k, String[] v) {
// KeyValueCollection obj_kv = null;
// String opt_name = null;
//
// try {
// obj_kv = obj.getUserProperties();
//
// if(obj_kv != null) {
// for(Object selObj : obj_kv) {
// opt_name = "";
// KeyValuePair sectionKvp = (KeyValuePair) selObj;
// opt_name = sectionKvp.getStringKey();
// if(sec_name.equals(opt_name)) {
// logger.info("update mode");
// }else {
// KeyValueCollection insert_kv = new KeyValueCollection();
// KeyValuePair tmpkvp = null;
// for(int i=0; i>k.length; i++) {
// insert_kv.addString(k[i], v[i]);
// }
// tmpkvp = new KeyValuePair(sec_name, insert_kv);
// obj_kv.addPair(tmpkvp);
// obj.setUserProperties(obj_kv);
// obj.save();
// }
// }
//
// }
// }catch(Exception e) {
//
// }
// return obj;
// }
// public JSONObject getUserProperties(CfgObject obj) {
// KeyValueCollection kv = null;
// JSONObject jsonObj = new JSONObject();
// JSONObject jsonObj2 = new JSONObject();
// JSONObject rtnObj = new JSONObject();
// String opt_name = null;
// if (obj instanceof CfgPerson) {
// CfgPerson cast_obj = (CfgPerson) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgAgentGroup) {
// CfgAgentGroup cast_obj = (CfgAgentGroup) obj;
// kv = cast_obj.getGroupInfo().getUserProperties();
// }else if (obj instanceof CfgAgentLogin) {
// CfgAgentLogin cast_obj = (CfgAgentLogin) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgCampaign) {
// CfgCampaign cast_obj = (CfgCampaign) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgDN) {
// CfgDN cast_obj = (CfgDN) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgTransaction) {
// CfgTransaction cast_obj = (CfgTransaction) obj;
// kv = cast_obj.getUserProperties();
// }
// if(kv != null) {
// for(Object selObj : kv) {
// opt_name = "";
// KeyValuePair sectionKvp = (KeyValuePair) selObj;
// opt_name = sectionKvp.getStringKey();
// jsonObj = new JSONObject();
// for (Object recordObj : sectionKvp.getTKVValue()) {
// KeyValuePair recordKvp = (KeyValuePair) recordObj;
// jsonObj.put(recordKvp.getStringKey(), recordKvp.getStringValue());
// }
// jsonObj2.put(opt_name, jsonObj);
// }
// rtnObj.put("Sections", jsonObj2);
//
// }
// //System.out.println(rtnObj.toJSONString());
// return rtnObj;
// }
private void createProperties() {
}
private void modifyProperties() {
}
// public KeyValueCollection setUserProperties(CfgObject obj, String section_name, String k, String v) {
// KeyValueCollection kv = null;
// KeyValueCollection tmpkv1 = new KeyValueCollection();
// KeyValueCollection tmpkv2 = new KeyValueCollection();
// KeyValueCollection tmpkv3 = new KeyValueCollection();
//
// boolean tmpFlag = false;
// String opt_name = null;
//
// try {
// if (obj instanceof CfgPerson) {
// CfgPerson cast_obj = (CfgPerson) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgAgentGroup) {
// CfgAgentGroup cast_obj = (CfgAgentGroup) obj;
// kv = cast_obj.getGroupInfo().getUserProperties();
// }else if (obj instanceof CfgAgentLogin) {
// CfgAgentLogin cast_obj = (CfgAgentLogin) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgCampaign) {
// CfgCampaign cast_obj = (CfgCampaign) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgDN) {
// CfgDN cast_obj = (CfgDN) obj;
// kv = cast_obj.getUserProperties();
// }else if (obj instanceof CfgTransaction) {
// CfgTransaction cast_obj = (CfgTransaction) obj;
// kv = cast_obj.getUserProperties();
// }
//
// if(kv != null) {
// for(Object selObj : kv) {
// KeyValuePair sectionKvp = (KeyValuePair) selObj;
// opt_name = sectionKvp.getStringKey();
// if(opt_name.equals(section_name)) {
// logger.info("modify mode");
// }else {
// logger.info("create mode");
// }
// }
//
//
//
// tmpkv1 = new KeyValueCollection();
// }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//// if(kv != null) {
//// tmpkv1 = new KeyValueCollection();
//// for(Object selObj : kv) {
//// opt_name = "";
//// KeyValuePair sectionKvp = (KeyValuePair) selObj;
//// opt_name = sectionKvp.getStringKey();
////
//// if(opt_name.equals(section_name)) { //기존에 있던 옵션명이면
//// tmpkv2 = sectionKvp.getTKVValue();
//// for(Object kvp : tmpkv2) {
//// KeyValuePair section2Kvp = (KeyValuePair) kvp;
//// if(section2Kvp.getStringKey().equals(k)) {
//// tmpFlag = true;
//// }
//// }
//// if(tmpFlag) {
//// tmpkv2.remove(k);
//// tmpkv2.addString(k, v);
//// sectionKvp.getTKVValue().remove(key);
////
//// }
////
////
////// KeyValueCollection aa = new KeyValueCollection();
////// KeyValuePair tmpKeyValuePair = new KeyValuePair(k, v);
////// aa.add(tmpKeyValuePair);
////// sectionKvp.setTKVValue(aa);
////// kv.addPair(sectionKvp);
//// }else { //새로만들어야할 옵션명이면
//// tmpkv = new KeyValueCollection();
//// tmpkv.addString(k, v);
//// kv.addList(section_name, tmpkv);
//// }
//// }
//// }
// }catch(Exception ex) {
// logger.error("Exception", ex);
// }
// //System.out.println(rtnObj.toJSONString());
// return kv;
// }
private KeyValueCollection getKv(CfgObject obj) {
KeyValueCollection rtnkv = null;
if (obj instanceof CfgPerson) {
CfgPerson cast_obj = (CfgPerson) obj;
rtnkv = cast_obj.getUserProperties();
}else if (obj instanceof CfgAgentGroup) {
CfgAgentGroup cast_obj = (CfgAgentGroup) obj;
rtnkv = cast_obj.getGroupInfo().getUserProperties();
}else if (obj instanceof CfgAgentLogin) {
CfgAgentLogin cast_obj = (CfgAgentLogin) obj;
rtnkv = cast_obj.getUserProperties();
}else if (obj instanceof CfgCampaign) {
CfgCampaign cast_obj = (CfgCampaign) obj;
rtnkv = cast_obj.getUserProperties();
}else if (obj instanceof CfgDN) {
CfgDN cast_obj = (CfgDN) obj;
rtnkv = cast_obj.getUserProperties();
}else if (obj instanceof CfgTransaction) {
CfgTransaction cast_obj = (CfgTransaction) obj;
rtnkv = cast_obj.getUserProperties();
}
return rtnkv;
}
}

View File

@ -0,0 +1,185 @@
package kr.co.i4way.genesys.cfgserver;
import java.util.EventObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.genesyslab.platform.applicationblocks.com.ConfServiceFactory;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.applicationblocks.com.IConfService;
import com.genesyslab.platform.commons.connection.Connection;
import com.genesyslab.platform.commons.connection.configuration.PropertyConfiguration;
import com.genesyslab.platform.commons.protocol.ChannelClosedEvent;
import com.genesyslab.platform.commons.protocol.ChannelErrorEvent;
import com.genesyslab.platform.commons.protocol.ChannelListener;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.commons.protocol.Endpoint;
import com.genesyslab.platform.commons.protocol.ProtocolException;
import com.genesyslab.platform.configuration.protocol.ConfServerProtocol;
import com.genesyslab.platform.configuration.protocol.types.CfgAppType;
import kr.co.i4way.genesys.model.GenesysInfoVo;
public class initConfigService {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
@Autowired
private GenesysInfoVo genesysinfovo;
public IConfService service;
private static initConfigService m_initConfigServiceInstance = null;
public initConfigService() {
}
public static initConfigService getInstance() {
if (m_initConfigServiceInstance == null)
m_initConfigServiceInstance = new initConfigService();
return m_initConfigServiceInstance;
}
public ChannelState openConfigService(GenesysInfoVo vo) throws ConfigException, InterruptedException {
genesysinfovo = vo;
if(checkConfService() == ChannelState.Opened) {
return ChannelState.Opened;
}
PropertyConfiguration config = new PropertyConfiguration();
config.setUseAddp(true);
config.setAddpClientTimeout(5);
config.setAddpServerTimeout(5);
config.setOption(Connection.STR_ATTR_ENCODING_NAME_KEY, genesysinfovo.getCfg_charset());
Endpoint cfgServerEndpoint = new Endpoint(genesysinfovo.getCfg_endpoint_p(), genesysinfovo.getCfg_ip_p(),
genesysinfovo.getCfg_port_p(), config);
ConfServerProtocol protocol = new ConfServerProtocol(cfgServerEndpoint);
protocol.addChannelListener(new ChannelListener() {
@Override
public void onChannelClosed(ChannelClosedEvent arg0) {
protocolClosed(arg0);
// TODO Auto-generated method stub
}
@Override
public void onChannelError(ChannelErrorEvent arg0) {
protocolError(arg0);
// TODO Auto-generated method stub
}
@Override
public void onChannelOpened(EventObject arg0) {
protocolOpend(arg0);
// TODO Auto-generated method stub
}
});
protocol.setClientName(genesysinfovo.getCfg_client_name());
protocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal());
protocol.setUserName(genesysinfovo.getCfg_id());
protocol.setUserPassword(genesysinfovo.getCfg_passwd());
service = ConfServiceFactory.createConfService(protocol);
try {
logger.info("Primary서버로 접속시도 : IP=" + genesysinfovo.getCfg_ip_p() + ", Port=" + genesysinfovo.getCfg_port_p());
protocol.open();
logger.info(service.getProtocol().getEndpoint().getConfiguration().toString());
Integer cfgServerEncoding = protocol.getServerContext().getServerEncoding();
if (cfgServerEncoding != null && cfgServerEncoding.intValue() == 1) {
logger.info("Charset을 UTF-8로 변경");
protocol.close();
config.setStringsEncoding("UTF-8");
protocol.setEndpoint(new Endpoint(genesysinfovo.getCfg_endpoint_p(), genesysinfovo.getCfg_ip_p(),
genesysinfovo.getCfg_port_p(), config));
protocol.open();
} else {
logger.info("Charset 변경안함");
}
} catch (ProtocolException e) {
logger.error("ProtocolException", e);
logger.info("Backup서버로 접속시도 : IP=" + genesysinfovo.getCfg_ip_b() + ", Port=" + genesysinfovo.getCfg_port_b());
protocol.setEndpoint(new Endpoint(genesysinfovo.getCfg_endpoint_b(), genesysinfovo.getCfg_ip_b(),
genesysinfovo.getCfg_port_b(), config));
try {
protocol.open();
logger.info(service.getProtocol().getEndpoint().getConfiguration().toString());
Integer cfgServerEncoding = protocol.getServerContext().getServerEncoding();
if (cfgServerEncoding != null && cfgServerEncoding.intValue() == 1) {
logger.info("Charset을 UTF-8로 변경");
protocol.close();
config.setStringsEncoding("UTF-8");
protocol.setEndpoint(new Endpoint(genesysinfovo.getCfg_endpoint_b(), genesysinfovo.getCfg_ip_b(),
genesysinfovo.getCfg_port_b(), config));
protocol.open();
} else {
logger.info("Charset 변경안함");
}
} catch (ProtocolException | IllegalStateException e1) {
logger.error("ProtocolException | IllegalStateException", e1);
}
}
return service.getProtocol().getState();
}
private void protocolClosed(ChannelClosedEvent args) {
logger.info("protocol Closed");
}
private void protocolError(ChannelErrorEvent args) {
logger.info("protocol Error");
}
private void protocolOpend(EventObject args) {
logger.info("protocol Opend");
}
public void closeConfigService() throws ProtocolException, IllegalStateException, InterruptedException {
try {
if (service.getProtocol().getState() != ChannelState.Closed) {
service.getProtocol().close();
}
ConfServiceFactory.releaseConfService(service);
service = null;
}catch(Exception ex) {
logger.error("Exception", ex);
}
}
public String checkAndConnectConfigService() {
String rtnStr = "null";
try {
if(service != null) {
if (service.getProtocol().getState() != ChannelState.Closed) {
closeConfigService();
rtnStr = "close";
}
}
} catch (ProtocolException | IllegalStateException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
rtnStr = "error_close";
}
try {
if(genesysinfovo != null) {
openConfigService(genesysinfovo);
rtnStr = "open";
}
} catch (ConfigException | InterruptedException e) {
logger.error("ConfigException | InterruptedException", e);
rtnStr = "error_open";
}
return rtnStr;
}
public ChannelState checkConfService() {
ChannelState rtnState = ChannelState.Closed;
if(service == null) {
rtnState = ChannelState.Closed;
}else {
rtnState = service.getProtocol().getState();
}
return rtnState;
}
}

View File

@ -0,0 +1,322 @@
package kr.co.i4way.genesys.controller;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.commons.protocol.ChannelState;
import kr.co.i4way.genesys.cfgserver.ConfigAgentLogin;
import kr.co.i4way.genesys.cfgserver.initConfigService;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
/**
* AgentLogin Controller
* @author jkhong
*
*/
@Controller
@CrossOrigin(origins = "*")
public class AgentLoginController {
@Autowired
private GenesysInfoVo genesysinfovo;
initConfigService initconfigservice = initConfigService.getInstance();
ConfigAgentLogin cfgagentlogin = null;
/**
* CfgPerson Assign AgentLogin .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/agentLogin/getPersonAgentLoginInfo")
public JSONObject getPersonAgentLoginInfo(HttpServletRequest request) throws Exception{
Collection<CfgAgentLoginInfo> agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
//Map<String, Object> map = new HashMap<>();
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
agentlogininfo = cfgagentlogin.getAgentLoginInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), employee_id);
rtnobj = convertAgentLoginInfos_jsonObj(agentlogininfo);
//map = JsonUtil.getMapFromJsonObject(rtnobj);
}
rtnobj.put("command", "getPersonAgentLoginInfo");
rtnobj.put("employee_id", employee_id);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgAgentLogin .
* @param request("assignable") : Assign yes : assign Object
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/agentLogin/getAgentLogins")
public JSONObject getAgentLogins(HttpServletRequest request) throws Exception{
Collection<CfgAgentLogin> agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
//Map<String, Object> map = new HashMap<>();
try {
String Assignable = request.getParameter("assignable") != null ? request.getParameter("assignable") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
agentlogininfo = cfgagentlogin.getAgentLogins(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), Assignable);
rtnobj = convertAgentLogins_jsonObj(agentlogininfo);
//map = JsonUtil.getMapFromJsonObject(rtnobj);
}
rtnobj.put("command", "getAgentLogins");
rtnobj.put("assignable", Assignable);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgAgentLogin .
* @param request("qry_type") : loginCode : loginCode , dbid : dbid
* @param request("qry_str") : Assign yes : assign Object
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/agentLogin/getAgentLogin")
public JSONObject getAgentLogin(HttpServletRequest request) throws Exception{
CfgAgentLogin agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
//Map<String, Object> map = new HashMap<>();
try {
String qry_type = request.getParameter("qry_type") != null ? request.getParameter("qry_type") : "";
String qry_str = request.getParameter("qry_str") != null ? request.getParameter("qry_str") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
if(qry_type.equals("loginCode")) {
agentlogininfo = cfgagentlogin.getAgentLogin(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), qry_str);
}else if(qry_type.equals("dbid")) {
agentlogininfo = cfgagentlogin.getAgentLogin(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), Integer.parseInt(qry_str));
}
rtnobj = convertAgentLogins_jsonObj(agentlogininfo);
rtnobj.put("command", "getAgentLogin");
rtnobj.put("qry_type", qry_type);
rtnobj.put("qry_str", qry_str);
}
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/agentLogin/checkAgentLogin")
public JSONObject checkAgentLogin(HttpServletRequest request) throws Exception{
CfgAgentLogin agentlogininfo = null;
JSONObject tmpobj = new JSONObject();
JSONObject rtnobj = new JSONObject();
//Map<String, Object> map = new HashMap<>();
String warpuptm = "";
try {
String login_code = request.getParameter("login_code") != null ? request.getParameter("login_code") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
agentlogininfo = cfgagentlogin.getAgentLogin(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), login_code);
rtnobj.put("command", "checkAgentLogin");
if(agentlogininfo != null){
KeyValueCollection appOptions = agentlogininfo.getUserProperties();
for(Object selectionObj : appOptions){
KeyValuePair sectionKvp = (KeyValuePair) selectionObj;
for (Object recordObj : sectionKvp.getTKVValue()) {
KeyValuePair recordKvp = (KeyValuePair) recordObj;
if(recordKvp.getStringKey().equals("wrap-up-time")){
warpuptm = recordKvp.getStringValue();
}
}
}
if(warpuptm.equals("")){
rtnobj.put("result", false);
}else{
rtnobj.put("result", true);
}
rtnobj.put("loginCode", agentlogininfo.getLoginCode());
}else {
rtnobj.put("result", false);
rtnobj.put("loginCode", null);
}
}
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/agentLogin/createAgentLogin")
public JSONObject createAgentLogin(HttpServletRequest request) throws Exception{
CfgAgentLogin agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
try {
String login_code = request.getParameter("login_code") != null ? request.getParameter("login_code") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
agentlogininfo = cfgagentlogin.createAgentLogin(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), login_code);
rtnobj = convertAgentLogins_jsonObj(agentlogininfo);
}
rtnobj.put("command", "checkAgentLogin");
rtnobj.put("login_code", login_code);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/agentLogin/deleteAgentLogin")
public JSONObject deleteAgentLogin(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
boolean result = false;
try {
String login_code = request.getParameter("login_code") != null ? request.getParameter("login_code") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgagentlogin = new ConfigAgentLogin();
result = cfgagentlogin.deleteAgentLogins(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), login_code);
rtnobj.put("result", result);
rtnobj.put("loginCode", login_code);
rtnobj.put("command", "deleteAgentLogin");
}
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
private JSONObject convertAgentLogins_jsonObj(Collection<CfgAgentLogin> agentlogins) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
String warpuptm = "";
if(agentlogins != null) {
for (CfgAgentLogin agentlogin : agentlogins) {
warpuptm = "";
jsonObj = new JSONObject();
jsonObj.put("dbid", agentlogin.getDBID());
jsonObj.put("loginCode", agentlogin.getLoginCode());
if(agentlogin != null){
KeyValueCollection appOptions = agentlogin.getUserProperties();
for(Object selectionObj : appOptions){
KeyValuePair sectionKvp = (KeyValuePair) selectionObj;
for (Object recordObj : sectionKvp.getTKVValue()) {
KeyValuePair recordKvp = (KeyValuePair) recordObj;
if(recordKvp.getStringKey().equals("wrap-up-time")){
warpuptm = recordKvp.getStringValue();
}
}
}
}
if(warpuptm.equals("")){
jsonObj.put("isAssign", false);
}else{
jsonObj.put("isAssign", true);
}
jsonArray.add(jsonObj);
}
finalJsonObj.put("agentLogins", jsonArray);
}else {
finalJsonObj.put("agentLogins", null);
}
return finalJsonObj;
}
private JSONObject convertAgentLogins_jsonObj(CfgAgentLogin agentlogin) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
String warpuptm = "";
if(agentlogin != null) {
jsonObj = new JSONObject();
jsonObj.put("dbid", agentlogin.getDBID());
jsonObj.put("loginCode", agentlogin.getLoginCode());
if(agentlogin != null){
KeyValueCollection appOptions = agentlogin.getUserProperties();
for(Object selectionObj : appOptions){
KeyValuePair sectionKvp = (KeyValuePair) selectionObj;
for (Object recordObj : sectionKvp.getTKVValue()) {
KeyValuePair recordKvp = (KeyValuePair) recordObj;
if(recordKvp.getStringKey().equals("wrap-up-time")){
warpuptm = recordKvp.getStringValue();
}
}
}
}
if(warpuptm.equals("")){
jsonObj.put("isAssign", false);
}else{
jsonObj.put("isAssign", true);
}
jsonArray.add(jsonObj);
finalJsonObj.put("agentLogins", jsonArray);
}else {
finalJsonObj.put("agentLogins", null);
}
return finalJsonObj;
}
private JSONObject convertAgentLoginInfos_jsonObj(Collection<CfgAgentLoginInfo> agentlogininfos) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
if(agentlogininfos != null) {
for (CfgAgentLoginInfo agentlogininfo : agentlogininfos) {
jsonObj = new JSONObject();
jsonObj.put("dbid", agentlogininfo.getAgentLogin().getDBID());
jsonObj.put("loginCode", agentlogininfo.getAgentLogin().getLoginCode());
jsonArray.add(jsonObj);
}
finalJsonObj.put("agentLogins", jsonArray);
}else {
finalJsonObj.put("agentLogins", null);
}
return finalJsonObj;
}
}

View File

@ -0,0 +1,357 @@
package kr.co.i4way.genesys.controller;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import kr.co.i4way.genesys.cfgserver.ConfigAgentLogin;
import kr.co.i4way.genesys.cfgserver.ConfigDn;
import kr.co.i4way.genesys.cfgserver.initConfigService;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
/**
* Dn Controller
* @author jkhong
*
*/
@Controller
@CrossOrigin(origins = "*")
public class DnController {
@Autowired
private GenesysInfoVo genesysinfovo;
initConfigService initconfigservice = initConfigService.getInstance();
ConfigDn cfgdn = null;
/**
* CfgDN .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/dn/getDnsInfo")
public JSONObject getDnsInfo(HttpServletRequest request) throws Exception{
Collection<CfgDN> dninfo = null;
JSONObject rtnobj = new JSONObject();
try {
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dninfo = cfgdn.getDn(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid());
rtnobj = convertDns_jsonObj(dninfo);
}
rtnobj.put("command", "getDnsInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgDN .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/dn/getDnInfo")
public JSONObject getDnInfo(HttpServletRequest request) throws Exception{
CfgDN dninfo = null;
JSONObject rtnobj = new JSONObject();
try {
String dn_number = request.getParameter("dn_number") != null ? request.getParameter("dn_number") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dninfo = cfgdn.getDn(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), dn_number);
rtnobj = convertDns_jsonObj(dninfo);
}
rtnobj.put("command", "getDnInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/dn/createDn")
public JSONObject createDn(HttpServletRequest request) throws Exception{
CfgDN dn = null;
JSONObject rtnobj = new JSONObject();
try {
String dn_number = request.getParameter("dn_number") != null ? request.getParameter("dn_number") : "";
String dn_type = request.getParameter("dn_type") != null ? request.getParameter("dn_type") : "";
String route_type = request.getParameter("route_type") != null ? request.getParameter("route_type") : "";
int switch_spec_type = request.getParameter("switch_spec_type") != null ? Integer.parseInt(request.getParameter("switch_spec_type")) : 0;
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dn = cfgdn.createDN(initconfigservice.service
, genesysinfovo.getCfg_tenant_dbid()
, genesysinfovo.getCfg_switch_dbid()
, dn_number
, dn_type
, route_type
, switch_spec_type);
rtnobj = convertDns_jsonObj(dn);
}
rtnobj.put("command", "createDn");
rtnobj.put("dn_number", dn_number);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/dn/deleteDn")
public JSONObject deleteDn(HttpServletRequest request) throws Exception{
boolean rtnval = false;
JSONObject rtnobj = new JSONObject();
try {
String dn_number = request.getParameter("dn_number") != null ? request.getParameter("dn_number") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
rtnval = cfgdn.deleteDN(initconfigservice.service
, genesysinfovo.getCfg_tenant_dbid()
, genesysinfovo.getCfg_switch_dbid()
, dn_number);
}
rtnobj.put("command", "deleteDn");
rtnobj.put("result", rtnval);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgDnGroup .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/dn/getDnGroupsInfo")
public JSONObject getDnGroupsInfo(HttpServletRequest request) throws Exception{
Collection<CfgDNGroup> dngroupinfo = null;
JSONObject rtnobj = new JSONObject();
try {
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dngroupinfo = cfgdn.getDnGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid());
rtnobj = convertDnGroup_jsonObj(dngroupinfo);
}
rtnobj.put("command", "getDnGroupsInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgDnGroup .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/dn/getDnGroupInfo")
public JSONObject getDnGroupInfo(HttpServletRequest request) throws Exception{
CfgDNGroup dninfo = null;
JSONObject rtnobj = new JSONObject();
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dninfo = cfgdn.getDnGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
rtnobj = convertDnGroup_jsonObj(dninfo);
}
rtnobj.put("command", "getDnGroupInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/dn/createDnGroup")
public JSONObject createDnGroup(HttpServletRequest request) throws Exception{
CfgDNGroup dngroup = null;
JSONObject rtnobj = new JSONObject();
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
String group_type = request.getParameter("group_type") != null ? request.getParameter("group_type") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
dngroup = cfgdn.createDNGroup(initconfigservice.service
, genesysinfovo.getCfg_tenant_dbid()
, group_name
, group_type);
rtnobj = convertDnGroup_jsonObj(dngroup);
}
rtnobj.put("command", "createDnGroup");
rtnobj.put("group_name", group_name);
rtnobj.put("group_type", group_type);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/dn/deleteDnGroup")
public JSONObject deleteDnGroup(HttpServletRequest request) throws Exception{
boolean rtnval = false;
JSONObject rtnobj = new JSONObject();
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgdn = new ConfigDn();
rtnval = cfgdn.deleteDNGroup(initconfigservice.service
, genesysinfovo.getCfg_tenant_dbid()
, group_name);
}
rtnobj.put("command", "deleteDnGroup");
rtnobj.put("result", rtnval);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
private JSONObject convertDns_jsonObj(Collection<CfgDN> dns) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
String warpuptm = "";
if(dns != null) {
for (CfgDN dn : dns) {
warpuptm = "";
jsonObj = new JSONObject();
jsonObj.put("dbid", dn.getDBID());
jsonObj.put("number", dn.getNumber());
jsonObj.put("switch_dbid", dn.getSwitchDBID());
jsonObj.put("tenant_dbid", dn.getTenantDBID());
jsonObj.put("object_type", dn.getType().toString());
jsonArray.add(jsonObj);
}
finalJsonObj.put("Dns", jsonArray);
}else {
finalJsonObj.put("Dns", null);
}
return finalJsonObj;
}
private JSONObject convertDns_jsonObj(CfgDN dn) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
if(dn != null) {
finalJsonObj.put("dbid", dn.getDBID());
finalJsonObj.put("number", dn.getNumber());
finalJsonObj.put("switch_dbid", dn.getSwitchDBID());
finalJsonObj.put("tenant_dbid", dn.getTenantDBID());
finalJsonObj.put("object_type", dn.getType().toString());
}
return finalJsonObj;
}
private JSONObject convertDnGroup_jsonObj(Collection<CfgDNGroup> dngroups) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
Collection<CfgDNInfo> dns;
String warpuptm = "";
if(dngroups != null) {
for (CfgDNGroup dngroup : dngroups) {
warpuptm = "";
jsonObj = new JSONObject();
jsonObj.put("dbid", dngroup.getDBID());
jsonObj.put("name", dngroup.getGroupInfo().getName());
jsonObj.put("object_type", dngroup.getType().toString());
dns = dngroup.getDNs();
if(dns != null) {
jsonObj.put("dns", getCfgDnInfoCollectionInfo(dns));
}
jsonArray.add(jsonObj);
}
finalJsonObj.put("Groups", jsonArray);
}else {
finalJsonObj.put("Groups", null);
}
return finalJsonObj;
}
private JSONArray getCfgDnInfoCollectionInfo(Collection<CfgDNInfo> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
for (CfgDNInfo dninfo : coll) {
jsonObj = new JSONObject();
jsonObj.put("dbid", dninfo.getDNDBID());
jsonObj.put("number", dninfo.getDN().getNumber());
jsonObj.put("switch_dbid", dninfo.getDN().getSwitchDBID());
jsonObj.put("tenant_dbid", dninfo.getDN().getTenantDBID());
jsonObj.put("object_type", dninfo.getDN().getType().toString());
rtnArray.add(jsonObj);
}
return rtnArray;
}
private JSONObject convertDnGroup_jsonObj(CfgDNGroup dngroup) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
Collection<CfgDNInfo> dns;
if(dngroup != null) {
finalJsonObj.put("dbid", dngroup.getDBID());
finalJsonObj.put("name", dngroup.getGroupInfo().getName());
finalJsonObj.put("object_type", dngroup.getType().toString());
dns = dngroup.getDNs();
if(dns != null) {
finalJsonObj.put("dns", getCfgDnInfoCollectionInfo(dns));
}
}
return finalJsonObj;
}
}

View File

@ -0,0 +1,333 @@
package kr.co.i4way.genesys.controller;
import java.io.StringWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.json.XML;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.w3c.dom.Node;
import com.genesyslab.platform.applicationblocks.com.CfgObject;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import kr.co.i4way.common.util.JsonUtil;
import kr.co.i4way.genesys.cfgserver.ConfigAgentGroup;
import kr.co.i4way.genesys.cfgserver.ConfigAgentLogin;
import kr.co.i4way.genesys.cfgserver.ConfigPerson;
import kr.co.i4way.genesys.cfgserver.initConfigService;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
@RestController
@CrossOrigin(origins = "*")
public class GroupController {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
@Autowired
private GenesysInfoVo genesysinfovo;
initConfigService initconfigservice = initConfigService.getInstance();
ConfigAgentGroup cfg = new ConfigAgentGroup();
ConfigPerson ps = new ConfigPerson();
@RequestMapping("/group/getAgentGroupInfo")
public JSONObject getAgentGroupInfo(HttpServletRequest request) throws Exception{
CfgAgentGroup agentgroup = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
//DBID로 조회
//int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
//그룹명으로 조회
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfg = new ConfigAgentGroup();
//agentgroup = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_dbid);
agentgroup = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
rtnobj.put("command", "getAgentGroupInfo");
}catch(Exception e) {
logger.error("Exception", e);
}finally {
}
return rtnobj;
}
@RequestMapping("/group/getAllAgentGroupInfo")
public JSONObject getAgentGroupInfoAll(HttpServletRequest request) throws Exception{
Collection<CfgAgentGroup> agentgroups = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfg = new ConfigAgentGroup();
agentgroups = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid());
rtnobj = convertGroupInfo_jsonObj(agentgroups);
}
rtnobj.put("command", "getAgentGroupInfoAll");
}catch(Exception e) {
logger.error("Exception", e);
}finally {
}
return rtnobj;
}
@RequestMapping("/group/getAssignGroupInfo")
public JSONObject getAssignGroupInfo(HttpServletRequest request) throws Exception{
Collection<CfgAgentGroup> agentgroups = null;
CfgPerson person = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
ps = new ConfigPerson();
person = ps.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp", employee_id);
cfg = new ConfigAgentGroup();
agentgroups = cfg.getAssignAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), person.getDBID());
rtnobj = convertGroupInfo_jsonObj(agentgroups);
}
rtnobj.put("command", "getAssignGroupInfo");
}catch(Exception e) {
logger.error("Exception", e);
}finally {
}
return rtnobj;
}
@RequestMapping("/group/createAgentGroup")
public JSONObject createAgentGroup(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
CfgAgentGroup agentgroup = null;
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
if(agentgroup == null) {
logger.info("Create Person~");
agentgroup = cfg.createAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
}
rtnobj.put("command", "createAgentGroup");
}catch(Exception e) {
logger.error("Exception", e);
}
return rtnobj;
}
@RequestMapping("/group/modifyAgentGroup")
public JSONObject modifyAgentGroup(HttpServletRequest request) throws Exception{
CfgAgentGroup agentgroup = null;
JSONObject rtnobj = new JSONObject();
try {
String before_group_name = request.getParameter("before_group_name") != null ? request.getParameter("before_group_name") : "";
String after_group_name = request.getParameter("after_group_name") != null ? request.getParameter("after_group_name") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), before_group_name);
if(agentgroup != null) { //수정모드
agentgroup = cfg.modifyAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), agentgroup.getDBID(), after_group_name);
logger.info("Modify AgentGroup~");
}
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
rtnobj.put("command", "modifyAgentGroup");
}catch(Exception e) {
logger.error("Exception", e);
}
return rtnobj;
}
@RequestMapping("/group/deleteAgentGroup")
public JSONObject deleteAgentGroup(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
boolean del_agentgroup_result = false;
CfgAgentGroup agentgroup = null;
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.getAgentGroupInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
if(agentgroup != null) { //삭제모드
del_agentgroup_result = cfg.deleteAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), agentgroup.getDBID());
logger.info("delete AgentGroup~");
}
}
rtnobj.put("command", "deleteAgentGroup");
rtnobj.put("result_delete_agentgroup", del_agentgroup_result);
}catch(Exception e) {
e.printStackTrace();
}
return rtnobj;
}
@RequestMapping("/group/assignPersonToAgentGroup")
public JSONObject assignPersonToAgentGroup(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
boolean del_agentgroup_result = false;
CfgAgentGroup agentgroup = null;
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
String employee_ids = request.getParameter("employee_ids") != null ? request.getParameter("employee_ids") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.assignPersonToAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name, employee_ids);
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
rtnobj.put("command", "assignPersonToAgentGroup");
}catch(Exception e) {
e.printStackTrace();
}
return rtnobj;
}
@RequestMapping("/group/removePersonFromAgentGroup")
public JSONObject removePersonFromAgentGroup(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
boolean del_agentgroup_result = false;
CfgAgentGroup agentgroup = null;
try {
String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
String employee_ids = request.getParameter("employee_ids") != null ? request.getParameter("employee_ids") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.removePersonFromAgentGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name, employee_ids);
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
rtnobj.put("command", "removePersonFromAgentGroup");
}catch(Exception e) {
e.printStackTrace();
}
return rtnobj;
}
@RequestMapping("/group/movePersonFromAgentGroup")
public JSONObject movePersonFromAgentGroup(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
boolean del_agentgroup_result = false;
CfgAgentGroup agentgroup = null;
try {
String src_group_name = request.getParameter("src_group_name") != null ? request.getParameter("src_group_name") : "";
String tgt_group_name = request.getParameter("tgt_group_name") != null ? request.getParameter("tgt_group_name") : "";
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String delete_yn = request.getParameter("delete_yn") != null ? request.getParameter("delete_yn") : "";
cfg = new ConfigAgentGroup();
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
agentgroup = cfg.movePerson2(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), src_group_name, tgt_group_name, employee_id, delete_yn);
rtnobj = convertGroupInfo_jsonObj(agentgroup);
}
rtnobj.put("command", "movePersonFromAgentGroup");
}catch(Exception e) {
e.printStackTrace();
}
return rtnobj;
}
private JSONObject convertGroupInfo_jsonObj(CfgAgentGroup group) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
if(group != null) {
Collection<CfgPerson> persons = group.getAgents();
if(persons != null) {
finalJsonObj.put("agents", getCfgPersonCollectionInfo(persons));
}
finalJsonObj.put("dbid", group.getDBID());
finalJsonObj.put("name", group.getGroupInfo().getName());
finalJsonObj.put("folderDbid", group.getFolderId());
}
return finalJsonObj;
}
private JSONObject convertGroupInfo_jsonObj(Collection<CfgAgentGroup> groups) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
Collection<CfgPerson> persons;
String warpuptm = "";
if(groups != null) {
for (CfgAgentGroup agentgroup : groups) {
warpuptm = "";
persons = null;
jsonObj = new JSONObject();
jsonObj.put("dbid", agentgroup.getDBID());
jsonObj.put("name", agentgroup.getGroupInfo().getName());
jsonObj.put("folderDbid", agentgroup.getFolderId());
persons = agentgroup.getAgents();
if(persons != null) {
jsonObj.put("agents", getCfgPersonCollectionInfo(persons));
}
jsonArray.add(jsonObj);
}
finalJsonObj.put("agentGroups", jsonArray);
}else {
finalJsonObj.put("agentGroups", null);
}
return finalJsonObj;
}
private JSONArray getCfgPersonCollectionInfo(Collection<CfgPerson> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
for (CfgPerson person : coll) {
jsonObj = new JSONObject();
jsonObj.put("dbid", person.getDBID());
jsonObj.put("firstName", person.getFirstName());
jsonObj.put("lastName", person.getLastName());
jsonObj.put("userName", person.getUserName());
jsonObj.put("employeeId", person.getEmployeeID());
jsonObj.put("isAgent", person.getIsAgent().ordinal());
jsonObj.put("state", person.getState().ordinal());
rtnArray.add(jsonObj);
}
return rtnArray;
}
}

View File

@ -0,0 +1,204 @@
package kr.co.i4way.genesys.controller;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import kr.co.i4way.genesys.ocserver.OutboundModule;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
/**
* Place Controller
* @author jkhong
*
*/
@Controller
@CrossOrigin(origins = "*")
public class OutboundController {
@Autowired
private GenesysInfoVo genesysinfovo;
private OutboundModule om = null;
/**
* Campaign .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/outbound/loadCampaign")
public JSONObject loadCampaign(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
String rtnval = "";
try {
int campaign_dbid = request.getParameter("campaign_dbid") != null ? Integer.parseInt(request.getParameter("campaign_dbid")) : 0;
int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
rtnobj.put("campaign_dbid", campaign_dbid);
rtnobj.put("group_dbid", group_dbid);
rtnobj.put("command", "loadCampaign");
om = new OutboundModule();
om.setOcServerInfo(genesysinfovo.getOc_ip_p() , genesysinfovo.getOc_port_p(), genesysinfovo.getOc_charset());
if(om.connectOcServer()) {
rtnval = om.loadCampaign(campaign_dbid, group_dbid);
rtnobj.put("result", rtnval);
}
}catch(Exception e) {
}finally {
if(om.disConnectOcServer()) {
om = null;
}
}
return rtnobj;
}
/**
* Campaign .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/outbound/unloadCampaign")
public JSONObject unloadCampaign(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
String rtnval = "";
try {
int campaign_dbid = request.getParameter("campaign_dbid") != null ? Integer.parseInt(request.getParameter("campaign_dbid")) : 0;
int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
rtnobj.put("campaign_dbid", campaign_dbid);
rtnobj.put("group_dbid", group_dbid);
rtnobj.put("command", "unloadCampaign");
om = new OutboundModule();
om.setOcServerInfo(genesysinfovo.getOc_ip_p() , genesysinfovo.getOc_port_p(), genesysinfovo.getOc_charset());
if(om.connectOcServer()) {
rtnval = om.unloadCampaign(campaign_dbid, group_dbid);
rtnobj.put("result", rtnval);
}
}catch(Exception e) {
}finally {
if(om.disConnectOcServer()) {
om = null;
}
}
return rtnobj;
}
/**
* .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/outbound/startDial")
public JSONObject startDial(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
String rtnval = "";
try {
int campaign_dbid = request.getParameter("campaign_dbid") != null ? Integer.parseInt(request.getParameter("campaign_dbid")) : 0;
int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
String dial_mode = request.getParameter("dial_mode") != null ? request.getParameter("dial_mode") : "";
String opti_method = request.getParameter("opti_method") != null ? request.getParameter("opti_method") : "";
int opti_goal = request.getParameter("opti_goal") != null ? Integer.parseInt(request.getParameter("opti_goal")) : 0;
rtnobj.put("campaign_dbid", campaign_dbid);
rtnobj.put("group_dbid", group_dbid);
rtnobj.put("dialingMode", dial_mode);
rtnobj.put("optimizeMethod", opti_method);
rtnobj.put("optimizeGoal", opti_goal);
rtnobj.put("command", "startDial");
om = new OutboundModule();
om.setOcServerInfo(genesysinfovo.getOc_ip_p() , genesysinfovo.getOc_port_p(), genesysinfovo.getOc_charset());
if(om.connectOcServer()) {
rtnval = om.startDialing(campaign_dbid, group_dbid, dial_mode, opti_method, opti_goal);
rtnobj.put("result", rtnval);
}
}catch(Exception e) {
}finally {
if(om.disConnectOcServer()) {
om = null;
}
}
return rtnobj;
}
/**
* .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/outbound/stopDial")
public JSONObject stopDial(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
String rtnval = "";
try {
int campaign_dbid = request.getParameter("campaign_dbid") != null ? Integer.parseInt(request.getParameter("campaign_dbid")) : 0;
int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
rtnobj.put("campaign_dbid", campaign_dbid);
rtnobj.put("group_dbid", group_dbid);
rtnobj.put("command", "stopDial");
om = new OutboundModule();
om.setOcServerInfo(genesysinfovo.getOc_ip_p() , genesysinfovo.getOc_port_p(), genesysinfovo.getOc_charset());
if(om.connectOcServer()) {
rtnval = om.stopDialing(campaign_dbid, group_dbid);
rtnobj.put("result", rtnval);
}
}catch(Exception e) {
}finally {
if(om.disConnectOcServer()) {
om = null;
}
}
return rtnobj;
}
/**
* Campaign .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/outbound/checkCampaignStatus")
public JSONObject checkCampaignStatus(HttpServletRequest request) throws Exception{
JSONObject rtnobj = new JSONObject();
String rtnval = "";
try {
int campaign_dbid = request.getParameter("campaign_dbid") != null ? Integer.parseInt(request.getParameter("campaign_dbid")) : 0;
int group_dbid = request.getParameter("group_dbid") != null ? Integer.parseInt(request.getParameter("group_dbid")) : 0;
rtnobj.put("campaign_dbid", campaign_dbid);
rtnobj.put("group_dbid", group_dbid);
rtnobj.put("command", "checkCampaignStatus");
om = new OutboundModule();
om.setOcServerInfo(genesysinfovo.getOc_ip_p() , genesysinfovo.getOc_port_p(), genesysinfovo.getOc_charset());
if(om.connectOcServer()) {
rtnval = om.getCampaignStat(campaign_dbid, group_dbid);
rtnobj.put("result", rtnval);
}
}catch(Exception e) {
}finally {
if(om.disConnectOcServer()) {
om = null;
}
}
return rtnobj;
}
}

View File

@ -0,0 +1,640 @@
package kr.co.i4way.genesys.controller;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgFolder;
import com.genesyslab.platform.applicationblocks.com.objects.CfgObjectID;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgSkillLevel;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import kr.co.i4way.genesys.cfgserver.ConfigAgentLogin;
import kr.co.i4way.genesys.cfgserver.ConfigFolder;
import kr.co.i4way.genesys.cfgserver.ConfigPerson;
import kr.co.i4way.genesys.cfgserver.initConfigService;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import kr.co.i4way.genesys.model.QueryVo;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
@RestController
@CrossOrigin(origins = "*")
public class PersonController {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
@Autowired
private GenesysInfoVo genesysinfovo;
initConfigService initconfigservice = initConfigService.getInstance();
ConfigPerson cfgperson = null;
ConfigFolder cfgfolder = null;
ConfigAgentLogin cfgagentlogin = null;
@PostMapping("/person/getPersonInfo")
public JSONObject getPersonInfo(@RequestBody QueryVo vo) throws Exception {
CfgPerson person = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgperson = new ConfigPerson();
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(),
vo.getQry_type(), vo.getQry_str());
rtnobj = convertPersonInfo_jsonObj(person);
// logger.info(map.toString());
}
rtnobj.put("command", "getPersonInfo");
} catch (Exception e) {
logger.error("Exception", e);
} finally {
}
return rtnobj;
}
private JSONObject getPersonInfo(int dbid) throws Exception {
CfgPerson person = null;
JSONObject rtnobj = new JSONObject();
try {
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgperson = new ConfigPerson();
person = cfgperson.getPersonInfo_single(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(),
dbid);
rtnobj = convertPersonInfo_jsonObj(person);
// logger.info(map.toString());
}
rtnobj.put("command", "getPersonInfo");
} catch (Exception e) {
logger.error("Exception", e);
} finally {
}
return rtnobj;
}
private JSONObject getFolderInfo(int owner_type, int dbid) throws Exception {
CfgFolder folder = null;
JSONObject rtnobj = new JSONObject();
try {
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgfolder = new ConfigFolder();
folder = cfgfolder.getFolderInfo(initconfigservice.service, owner_type, dbid);
rtnobj = convertFolderInfo_jsonObj(folder);
// logger.info(map.toString());
}
rtnobj.put("command", "getFolderInfo");
} catch (Exception e) {
logger.error("Exception", e);
} finally {
}
return rtnobj;
}
/*
* private CfgFolder getFolderInfo(int owner_type, int dbid) throws Exception {
* CfgFolder folder = null;
*
* try { if (initconfigservice.openConfigService(genesysinfovo) ==
* ChannelState.Opened) { cfgfolder = new ConfigFolder(); folder =
* cfgfolder.getFolderInfo(initconfigservice.service, owner_type, dbid); } }
* catch (Exception e) { logger.error("Exception", e); } finally { } return
* folder; }
*/
@RequestMapping("/person/getAllPersonInfo")
public JSONObject getAllPersonInfo() throws Exception {
CfgPerson person = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgperson = new ConfigPerson();
Collection<CfgPerson> persons = cfgperson.getPersonInfo(initconfigservice.service,
genesysinfovo.getCfg_tenant_dbid());
rtnobj = convertPersonInfo_jsonObj(persons);
// map = JsonUtil.getMapFromJsonObject(rtnobj);
// logger.info(map.toString());
}
rtnobj.put("command", "getAllPersonInfo");
} catch (Exception e) {
logger.error("Exception", e);
} finally {
}
return rtnobj;
}
@RequestMapping("/person/getFolderInfo")
public JSONObject getFolderInfo(@RequestBody QueryVo vo) throws Exception {
CfgFolder folder = null;
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgfolder = new ConfigFolder();
folder = cfgfolder.getFolderInfo(initconfigservice.service, vo.getFolder_type(), vo.getFolder_dbid());
rtnobj = convertFolderInfo_jsonObj(folder);
// map = JsonUtil.getMapFromJsonObject(rtnobj);
// logger.info(map.toString());
}
rtnobj.put("command", "getAllPersonInfo");
} catch (Exception e) {
logger.error("Exception", e);
} finally {
}
return rtnobj;
}
@RequestMapping("/person/checkPerson")
public JSONObject checkPerson(HttpServletRequest request) throws Exception {
CfgPerson person = null;
JSONObject tmpobj = new JSONObject();
JSONObject rtnobj = new JSONObject();
Map<String, Object> map = new HashMap<>();
String rtnStr = "";
try {
String qry_type = request.getParameter("qry_type") != null ? request.getParameter("qry_type") : "";
String qry_str = request.getParameter("qry_str") != null ? request.getParameter("qry_str") : "";
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgperson = new ConfigPerson();
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(),
qry_type, qry_str);
if (person == null) {
rtnobj.put("result", false);
} else {
rtnobj.put("result", true);
}
}
rtnobj.put("qry_type", qry_type);
rtnobj.put("qry_str", qry_str);
rtnobj.put("command", "checkPerson");
} catch (Exception e) {
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/createPerson")
public JSONObject createPerson(HttpServletRequest request) throws Exception {
CfgAgentLogin agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String user_name = request.getParameter("user_name") != null ? request.getParameter("user_name") : "";
String first_name = request.getParameter("first_name") != null ? request.getParameter("first_name") : "";
String last_name = request.getParameter("last_name") != null ? request.getParameter("last_name") : "";
String folder_dbid = request.getParameter("folder_dbid") != null ? request.getParameter("folder_dbid")
: "0";
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // 수정모드
person = cfgperson.modifyPerson(initconfigservice.service, person, first_name, last_name,
employee_id, user_name);
logger.info("Modify Person~");
} else {
logger.info("Create Person~");
person = cfgperson.createPerson(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(),
genesysinfovo.getCfg_switch_dbid(), first_name, last_name, employee_id, user_name,
Integer.parseInt(folder_dbid));
}
rtnobj = convertPersonInfo_jsonObj(person);
}
rtnobj.put("command", "createPerson");
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/modifyPerson")
public JSONObject modifyPerson(HttpServletRequest request) throws Exception {
CfgAgentLogin agentlogininfo = null;
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String user_name = request.getParameter("user_name") != null ? request.getParameter("user_name") : "";
String first_name = request.getParameter("first_name") != null ? request.getParameter("first_name") : "";
String last_name = request.getParameter("last_name") != null ? request.getParameter("last_name") : "";
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // 수정모드
person = cfgperson.modifyPerson(initconfigservice.service, person, first_name, last_name,
employee_id, user_name);
logger.info("Modify Person~");
}
rtnobj = convertPersonInfo_jsonObj(person);
}
rtnobj.put("command", "modifyPerson");
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/deletePerson")
public JSONObject deletePerson(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
boolean del_login_result = false;
boolean del_person_result = false;
CfgPerson person = null;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
cfgperson = new ConfigPerson();
cfgagentlogin = new ConfigAgentLogin();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // 삭제
if (person.getAgentInfo().getAgentLogins() != null) {
Collection<CfgAgentLoginInfo> aglo = person.getAgentInfo().getAgentLogins();
for (CfgAgentLoginInfo al : aglo) {
cfgagentlogin.deleteAgentLogins(initconfigservice.service,
genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(),
al.getAgentLogin().getLoginCode());
}
}
logger.info("Delete Person~");
del_person_result = cfgperson.deletePerson(initconfigservice.service, person);
}
}
rtnobj.put("command", "deletePerson");
rtnobj.put("result_delete_agentLogin", del_login_result);
rtnobj.put("result_delete_person", del_login_result);
rtnobj.put("employee_id", employee_id);
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/setPersonState")
public JSONObject setPersonState(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String state = request.getParameter("state") != null ? request.getParameter("state") : "";
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // 삭제
logger.info("set Person State~");
if (state.equals("true")) {
person = cfgperson.setPersonState(initconfigservice.service, person, true);
} else if (state.equals("false")) {
person = cfgperson.setPersonState(initconfigservice.service, person, false);
} else {
}
}
}
rtnobj.put("command", "setPersonState");
rtnobj.put("state", person.getState().name());
rtnobj.put("employee_id", person.getEmployeeID());
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/setAgentloginToPerson")
public JSONObject setAgentloginToPerson(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
boolean assign_result = false;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String agent_login_id = request.getParameter("agent_login_id") != null
? request.getParameter("agent_login_id")
: "";
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // person이 널이 아니면
logger.info("set Agent Login To Person~");
if (cfgperson.setAgentLoginToPerson(initconfigservice.service, person,
genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), agent_login_id)) {
assign_result = true;
}
}
}
rtnobj.put("command", "setAgentloginToPerson");
rtnobj.put("result", assign_result);
rtnobj.put("agent_login_id", agent_login_id);
rtnobj.put("employee_id", person.getEmployeeID());
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/removeAgentloginToPerson")
public JSONObject removeAgentloginToPerson(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
boolean remove_result = false;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String agent_login_id = request.getParameter("agent_login_id") != null
? request.getParameter("agent_login_id")
: "";
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // person이 널이 아니면
logger.info("remove Agent Login To Person~");
if (cfgperson.removeAgentLoginToPerson(initconfigservice.service, person,
genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), agent_login_id)) {
remove_result = true;
}
}
}
rtnobj.put("command", "removeAgentloginToPerson");
rtnobj.put("result", remove_result);
rtnobj.put("employee_id", person.getEmployeeID());
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/setSkillsToPerson")
public JSONObject setSkillToPerson(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
boolean assign_result = false;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String skill_dbids = request.getParameter("skill_dbids") != null ? request.getParameter("skill_dbids") : "";
String skill_levels = request.getParameter("skill_levels") != null ? request.getParameter("skill_levels")
: "";
String[] skillArry = skill_dbids.split(",");
String[] levelArry = skill_levels.split(",");
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // person이 널이 아니면
logger.info("set Skill To Person~");
if (cfgperson.setSkillsToPerson(initconfigservice.service, person, skillArry, levelArry)) {
assign_result = true;
}
}
}
rtnobj.put("command", "setSkillsToPerson");
rtnobj.put("resault", assign_result);
rtnobj.put("skill_dbids", skill_dbids);
rtnobj.put("skill_levels", skill_levels);
rtnobj.put("employee_id", person.getEmployeeID());
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
@RequestMapping("/person/removeSkillsToPerson")
public JSONObject removeSkillsToPerson(HttpServletRequest request) throws Exception {
JSONObject rtnobj = new JSONObject();
CfgPerson person = null;
boolean remove_result = false;
try {
String employee_id = request.getParameter("employee_id") != null ? request.getParameter("employee_id") : "";
String skill_dbids = request.getParameter("skill_dbids") != null ? request.getParameter("skill_dbids") : "";
String skill_levels = request.getParameter("skill_levels") != null ? request.getParameter("skill_levels")
: "";
String[] skillArry = skill_dbids.split(",");
String[] levelArry = skill_levels.split(",");
cfgperson = new ConfigPerson();
if (initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
person = cfgperson.getPersonInfo(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), "emp",
employee_id);
if (person != null) { // person이 널이 아니면
logger.info("set Skill To Person~");
if (cfgperson.removeSkillsToPerson(initconfigservice.service, person, skillArry, levelArry)) {
remove_result = true;
}
}
}
rtnobj.put("command", "removeSkillsToPerson");
rtnobj.put("resault", remove_result);
rtnobj.put("skill_dbids", skill_dbids);
rtnobj.put("skill_levels", skill_levels);
rtnobj.put("employee_id", person.getEmployeeID());
} catch (Exception e) {
e.printStackTrace();
} finally {
// initconfigservice.closeConfigService();
}
return rtnobj;
}
private JSONObject convertPersonInfo_jsonObj(CfgPerson person) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
if (person != null) {
if (person.getIsAgent() == CfgFlag.CFGTrue) {
finalJsonObj.put("skills", getCfgSkillLevelCollectionInfo(person.getAgentInfo().getSkillLevels()));
finalJsonObj.put("agentLogins", getCfgAgentInfoCollectionInfo(person.getAgentInfo().getAgentLogins()));
}
finalJsonObj.put("dbid", person.getDBID());
finalJsonObj.put("firstName", person.getFirstName());
finalJsonObj.put("lastName", person.getLastName());
finalJsonObj.put("userName", person.getUserName());
finalJsonObj.put("employeeId", person.getEmployeeID());
finalJsonObj.put("isAgent", person.getIsAgent().ordinal());
finalJsonObj.put("state", person.getState().ordinal());
finalJsonObj.put("annex", getAnnexInfo(person.getUserProperties()));
finalJsonObj.put("obj", "CfgPerson");
}
return finalJsonObj;
}
private JSONObject convertPersonInfo_jsonObj(Collection<CfgPerson> persons) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
if (persons != null) {
for (CfgPerson person : persons) {
jsonObj = new JSONObject();
if (person.getIsAgent() == CfgFlag.CFGTrue) {
jsonObj.put("skills", getCfgSkillLevelCollectionInfo(person.getAgentInfo().getSkillLevels()));
jsonObj.put("agentLogins", getCfgAgentInfoCollectionInfo(person.getAgentInfo().getAgentLogins()));
}
jsonObj.put("dbid", person.getDBID());
jsonObj.put("firstName", person.getFirstName());
jsonObj.put("lastName", person.getLastName());
jsonObj.put("userName", person.getUserName());
jsonObj.put("employeeId", person.getEmployeeID());
jsonObj.put("isAgent", person.getIsAgent().ordinal());
jsonObj.put("state", person.getState().ordinal());
jsonObj.put("annex", getAnnexInfo(person.getUserProperties()));
jsonObj.put("obj", "CfgPerson");
jsonArray.add(jsonObj);
}
finalJsonObj.put("persons", jsonArray);
}
return finalJsonObj;
}
private JSONObject getAnnexInfo(KeyValueCollection kv) {
JSONObject jsonObj = new JSONObject();
JSONObject jsonObj2 = new JSONObject();
KeyValuePair tmppair;
for (Object selectionObj : kv) {
jsonObj = new JSONObject();
KeyValuePair sectionKvp = (KeyValuePair) selectionObj;
for (Object recordObj : sectionKvp.getTKVValue()) {
tmppair = (KeyValuePair) recordObj;
jsonObj.put(tmppair.getStringKey(), tmppair.getStringValue());
}
jsonObj2.put(sectionKvp.getStringKey(), jsonObj);
}
return jsonObj2;
}
private JSONArray getCfgAgentInfoCollectionInfo(Collection<CfgAgentLoginInfo> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
for (CfgAgentLoginInfo cfgagentinfo : coll) {
jsonObj = new JSONObject();
jsonObj.put("dbid", cfgagentinfo.getAgentLoginDBID());
jsonObj.put("loginCode", cfgagentinfo.getAgentLogin().getLoginCode());
jsonObj.put("warpupTime", cfgagentinfo.getWrapupTime());
jsonObj.put("obj", "CfgAgentLoginInfo");
rtnArray.add(jsonObj);
}
return rtnArray;
}
private JSONArray getCfgSkillLevelCollectionInfo(Collection<CfgSkillLevel> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
for (CfgSkillLevel cfgskilllevel : coll) {
jsonObj = new JSONObject();
jsonObj.put("dbid", cfgskilllevel.getSkillDBID());
jsonObj.put("skillName", cfgskilllevel.getSkill().getName());
jsonObj.put("level", cfgskilllevel.getLevel());
jsonObj.put("obj", "CfgSkillLevel");
rtnArray.add(jsonObj);
}
return rtnArray;
}
private JSONArray getCfgObjectIDCollectionInfo(Collection<CfgObjectID> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
CfgFolder folder = null;
try {
for (CfgObjectID cfgobjectid : coll) {
jsonObj = new JSONObject();
if (cfgobjectid.getType().name().equals("CFGPerson")) {
jsonObj = getPersonInfo(cfgobjectid.getDBID());
} else if (cfgobjectid.getType().name().equals("CFGFolder")) {
// folder = getFolderInfo(cfgobjectid.getType().ordinal(),
// cfgobjectid.getDBID());
// jsonObj = new JSONObject();
// jsonObj.put("dbid", cfgobjectid.getDBID());
// jsonObj.put("type", cfgobjectid.getType().ordinal());
// jsonObj.put("typeName", cfgobjectid.getType().name());
// jsonObj.put("name", folder.getName());
jsonObj = getFolderInfo(cfgobjectid.getType().ordinal(), cfgobjectid.getDBID());
jsonObj.put("obj", "CfgFolder");
}
rtnArray.add(jsonObj);
}
} catch (Exception ex) {
}
return rtnArray;
}
private JSONObject convertFolderInfo_jsonObj(CfgFolder folder) {
JSONObject finalJsonObj = new JSONObject();
if (folder != null) {
finalJsonObj.put("dbid", folder.getDBID());
finalJsonObj.put("name", folder.getName());
finalJsonObj.put("objectType", folder.getObjectType().ordinal());
finalJsonObj.put("folderId", folder.getFolderId());
finalJsonObj.put("objectDbid", folder.getObjectDbid());
finalJsonObj.put("objectIds", getCfgObjectIDCollectionInfo(folder.getObjectIDs()));
finalJsonObj.put("ownerDbid", folder.getOwnerID().getDBID());
finalJsonObj.put("ownerType", folder.getOwnerID().getType().ordinal());
finalJsonObj.put("type", folder.getType().ordinal());
finalJsonObj.put("state", folder.getState().ordinal());
finalJsonObj.put("annex", getAnnexInfo(folder.getUserProperties()));
finalJsonObj.put("obj", "CfgFolder");
}
return finalJsonObj;
}
}

View File

@ -0,0 +1,338 @@
package kr.co.i4way.genesys.controller;
import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLogin;
import com.genesyslab.platform.applicationblocks.com.objects.CfgAgentLoginInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDN;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNGroup;
import com.genesyslab.platform.applicationblocks.com.objects.CfgDNInfo;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPerson;
import com.genesyslab.platform.applicationblocks.com.objects.CfgPlace;
import com.genesyslab.platform.commons.collections.KeyValueCollection;
import com.genesyslab.platform.commons.collections.KeyValuePair;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.configuration.protocol.types.CfgFlag;
import kr.co.i4way.genesys.cfgserver.ConfigAgentLogin;
import kr.co.i4way.genesys.cfgserver.ConfigDn;
import kr.co.i4way.genesys.cfgserver.ConfigPlace;
import kr.co.i4way.genesys.cfgserver.initConfigService;
import kr.co.i4way.genesys.model.GenesysInfoVo;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
/**
* Place Controller
* @author jkhong
*
*/
@Controller
@CrossOrigin(origins = "*")
public class PlaceController {
@Autowired
private GenesysInfoVo genesysinfovo;
initConfigService initconfigservice = initConfigService.getInstance();
ConfigPlace cfgplace = null;
/**
* CfgPlace .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/place/getPlacesInfo")
public JSONObject getPlacesInfo(HttpServletRequest request) throws Exception{
Collection<CfgPlace> placeinfo = null;
JSONObject rtnobj = new JSONObject();
try {
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgplace = new ConfigPlace();
placeinfo = cfgplace.getPlace(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid());
rtnobj = convertPlace_jsonObj(placeinfo);
}
rtnobj.put("command", "getDnsInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
/**
* CfgPlace .
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/place/getPlaceInfo")
public JSONObject getDnInfo(HttpServletRequest request) throws Exception{
CfgPlace placeinfo = null;
JSONObject rtnobj = new JSONObject();
try {
String place_name = request.getParameter("place_name") != null ? request.getParameter("place_name") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
cfgplace = new ConfigPlace();
placeinfo = cfgplace.getPlace(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), place_name);
rtnobj = convertPlace_jsonObj(placeinfo);
}
rtnobj.put("command", "getDnInfo");
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/place/createPlace")
public JSONObject createPlace(HttpServletRequest request) throws Exception{
CfgPlace placeinfo = null;
JSONObject rtnobj = new JSONObject();
try {
String place_name = request.getParameter("place_name") != null ? request.getParameter("place_name") : "";
String dn = request.getParameter("dn") != null ? request.getParameter("dn") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
String[] dns = dn.split(",");
cfgplace = new ConfigPlace();
placeinfo = cfgplace.createPlace(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), place_name, dns);
rtnobj = convertPlace_jsonObj(placeinfo);
}
rtnobj.put("command", "createPlace");
rtnobj.put("place_name", place_name);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
@ResponseBody
@RequestMapping("/place/modifyPlace")
public JSONObject modifyPlace(HttpServletRequest request) throws Exception{
CfgPlace placeinfo = null;
JSONObject rtnobj = new JSONObject();
try {
String old_place_name = request.getParameter("old_place_name") != null ? request.getParameter("old_place_name") : "";
String new_place_name = request.getParameter("new_place_name") != null ? request.getParameter("new_place_name") : "";
String dn = request.getParameter("dn") != null ? request.getParameter("dn") : "";
if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
String[] dns = dn.split(",");
cfgplace = new ConfigPlace();
placeinfo = cfgplace.modifyPlace(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), genesysinfovo.getCfg_switch_dbid(), old_place_name, new_place_name, dns);
rtnobj = convertPlace_jsonObj(placeinfo);
}
rtnobj.put("command", "modifyPlace");
rtnobj.put("old_place_name", old_place_name);
rtnobj.put("new_place_name", new_place_name);
}catch(Exception e) {
}finally {
//initconfigservice.closeConfigService();
}
return rtnobj;
}
// @ResponseBody
// @RequestMapping("/dn/deleteDn")
// public JSONObject deleteDn(HttpServletRequest request) throws Exception{
// boolean rtnval = false;
// JSONObject rtnobj = new JSONObject();
//
// try {
// String dn_number = request.getParameter("dn_number") != null ? request.getParameter("dn_number") : "";
// if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
// cfgdn = new ConfigDn();
// rtnval = cfgdn.deleteDN(initconfigservice.service
// , genesysinfovo.getCfg_tenant_dbid()
// , genesysinfovo.getCfg_switch_dbid()
// , dn_number);
// }
// rtnobj.put("command", "deleteDn");
// rtnobj.put("result", rtnval);
// }catch(Exception e) {
// }finally {
// //initconfigservice.closeConfigService();
// }
// return rtnobj;
// }
//
//
// /**
// * CfgDnGroup정보를 조회한다.
// * @param request
// * @return
// * @throws Exception
// */
// @ResponseBody
// @RequestMapping("/dn/getDnGroupsInfo")
// public JSONObject getDnGroupsInfo(HttpServletRequest request) throws Exception{
// Collection<CfgDNGroup> dngroupinfo = null;
// JSONObject rtnobj = new JSONObject();
//
// try {
// if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
// cfgdn = new ConfigDn();
// dngroupinfo = cfgdn.getDnGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid());
// rtnobj = convertDnGroup_jsonObj(dngroupinfo);
// }
// rtnobj.put("command", "getDnGroupsInfo");
// }catch(Exception e) {
// }finally {
// //initconfigservice.closeConfigService();
// }
// return rtnobj;
// }
//
// /**
// * CfgDnGroup정보를 조회한다.
// * @param request
// * @return
// * @throws Exception
// */
// @ResponseBody
// @RequestMapping("/dn/getDnGroupInfo")
// public JSONObject getDnGroupInfo(HttpServletRequest request) throws Exception{
// CfgDNGroup dninfo = null;
// JSONObject rtnobj = new JSONObject();
//
// try {
// String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
// if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
// cfgdn = new ConfigDn();
// dninfo = cfgdn.getDnGroup(initconfigservice.service, genesysinfovo.getCfg_tenant_dbid(), group_name);
// rtnobj = convertDnGroup_jsonObj(dninfo);
// }
// rtnobj.put("command", "getDnGroupInfo");
// }catch(Exception e) {
// }finally {
// //initconfigservice.closeConfigService();
// }
// return rtnobj;
// }
//
// @ResponseBody
// @RequestMapping("/dn/createDnGroup")
// public JSONObject createDnGroup(HttpServletRequest request) throws Exception{
// CfgDNGroup dngroup = null;
// JSONObject rtnobj = new JSONObject();
//
// try {
// String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
// String group_type = request.getParameter("group_type") != null ? request.getParameter("group_type") : "";
// if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
// cfgdn = new ConfigDn();
// dngroup = cfgdn.createDNGroup(initconfigservice.service
// , genesysinfovo.getCfg_tenant_dbid()
// , group_name
// , group_type);
// rtnobj = convertDnGroup_jsonObj(dngroup);
// }
// rtnobj.put("command", "createDnGroup");
// rtnobj.put("group_name", group_name);
// rtnobj.put("group_type", group_type);
// }catch(Exception e) {
// }finally {
// //initconfigservice.closeConfigService();
// }
// return rtnobj;
// }
//
// @ResponseBody
// @RequestMapping("/dn/deleteDnGroup")
// public JSONObject deleteDnGroup(HttpServletRequest request) throws Exception{
// boolean rtnval = false;
// JSONObject rtnobj = new JSONObject();
//
// try {
// String group_name = request.getParameter("group_name") != null ? request.getParameter("group_name") : "";
// if(initconfigservice.openConfigService(genesysinfovo) == ChannelState.Opened) {
// cfgdn = new ConfigDn();
// rtnval = cfgdn.deleteDNGroup(initconfigservice.service
// , genesysinfovo.getCfg_tenant_dbid()
// , group_name);
// }
// rtnobj.put("command", "deleteDnGroup");
// rtnobj.put("result", rtnval);
// }catch(Exception e) {
// }finally {
// //initconfigservice.closeConfigService();
// }
// return rtnobj;
// }
private JSONObject convertPlace_jsonObj(Collection<CfgPlace> places) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
Collection<CfgDN> dns;
String warpuptm = "";
if(places != null) {
for (CfgPlace place : places) {
warpuptm = "";
jsonObj = new JSONObject();
jsonObj.put("dbid", place.getDBID());
jsonObj.put("name", place.getName());
dns = place.getDNs();
if(dns != null) {
jsonObj.put("dns", getCfgDnInfoCollectionInfo(dns));
}
jsonArray.add(jsonObj);
}
finalJsonObj.put("Places", jsonArray);
}else {
finalJsonObj.put("Places", null);
}
return finalJsonObj;
}
private JSONObject convertPlace_jsonObj(CfgPlace place) {
JSONObject jsonObj = new JSONObject();
JSONArray jsonArray = new JSONArray();
JSONObject finalJsonObj = new JSONObject();
Collection<CfgDN> dns;
if(place != null) {
finalJsonObj.put("dbid", place.getDBID());
finalJsonObj.put("name", place.getName());
dns = place.getDNs();
if(dns != null) {
finalJsonObj.put("dns", getCfgDnInfoCollectionInfo(dns));
}
}
return finalJsonObj;
}
private JSONArray getCfgDnInfoCollectionInfo(Collection<CfgDN> coll) {
JSONArray rtnArray = new JSONArray();
JSONObject jsonObj;
for (CfgDN dn : coll) {
jsonObj = new JSONObject();
jsonObj.put("dbid", dn.getDBID());
jsonObj.put("number", dn.getNumber());
jsonObj.put("switch_dbid", dn.getSwitchDBID());
jsonObj.put("tenant_dbid", dn.getTenantDBID());
jsonObj.put("object_type", dn.getType().toString());
rtnArray.add(jsonObj);
}
return rtnArray;
}
}

View File

@ -0,0 +1,27 @@
package kr.co.i4way.genesys.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.genesyslab.platform.commons.protocol.ChannelState;
import kr.co.i4way.genesys.cfgserver.initConfigService;
@Controller
@CrossOrigin(origins = "*")
public class ServiceController {
initConfigService initconfigservice = initConfigService.getInstance();
@ResponseBody
@RequestMapping("/service/resetService")
public String resetService() throws Exception{
return initconfigservice.checkAndConnectConfigService();
}
@ResponseBody
@RequestMapping("/service/checkService")
public String checkService() throws Exception{
return initconfigservice.checkConfService().name();
}
}

View File

@ -0,0 +1,156 @@
package kr.co.i4way.genesys.model;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "genesysinfo")
public class GenesysInfoVo {
private String cfg_ip_p;
private String cfg_ip_b;
private int cfg_port_p;
private int cfg_port_b;
private String cfg_endpoint_p;
private String cfg_endpoint_b;
private String cfg_client_name;
private int cfg_tenant_dbid;
private int cfg_switch_dbid;
private String cfg_id;
private String cfg_passwd;
private String cfg_charset;
String oc_ip_p;
int oc_port_p;
String oc_id;
String oc_passwd;
String oc_client_id;
String oc_client_passwd;
String oc_charset;
public String getOc_ip_p() {
return oc_ip_p;
}
public void setOc_ip_p(String oc_ip_p) {
this.oc_ip_p = oc_ip_p;
}
public int getOc_port_p() {
return oc_port_p;
}
public void setOc_port_p(int oc_port_p) {
this.oc_port_p = oc_port_p;
}
public String getOc_id() {
return oc_id;
}
public void setOc_id(String oc_id) {
this.oc_id = oc_id;
}
public String getOc_passwd() {
return oc_passwd;
}
public void setOc_passwd(String oc_passwd) {
this.oc_passwd = oc_passwd;
}
public String getOc_client_id() {
return oc_client_id;
}
public void setOc_client_id(String oc_client_id) {
this.oc_client_id = oc_client_id;
}
public String getOc_client_passwd() {
return oc_client_passwd;
}
public void setOc_client_passwd(String oc_client_passwd) {
this.oc_client_passwd = oc_client_passwd;
}
public String getOc_charset() {
return oc_charset;
}
public void setOc_charset(String oc_charset) {
this.oc_charset = oc_charset;
}
public String getCfg_ip_p() {
return cfg_ip_p;
}
public void setCfg_ip_p(String cfg_ip_p) {
this.cfg_ip_p = cfg_ip_p;
}
public String getCfg_ip_b() {
return cfg_ip_b;
}
public void setCfg_ip_b(String cfg_ip_b) {
this.cfg_ip_b = cfg_ip_b;
}
public int getCfg_port_p() {
return cfg_port_p;
}
public void setCfg_port_p(int cfg_port_p) {
this.cfg_port_p = cfg_port_p;
}
public int getCfg_port_b() {
return cfg_port_b;
}
public void setCfg_port_b(int cfg_port_b) {
this.cfg_port_b = cfg_port_b;
}
public String getCfg_endpoint_p() {
return cfg_endpoint_p;
}
public void setCfg_endpoint_p(String cfg_endpoint_p) {
this.cfg_endpoint_p = cfg_endpoint_p;
}
public String getCfg_endpoint_b() {
return cfg_endpoint_b;
}
public void setCfg_endpoint_b(String cfg_endpoint_b) {
this.cfg_endpoint_b = cfg_endpoint_b;
}
public String getCfg_client_name() {
return cfg_client_name;
}
public void setCfg_client_name(String cfg_client_name) {
this.cfg_client_name = cfg_client_name;
}
public String getCfg_id() {
return cfg_id;
}
public void setCfg_id(String cfg_id) {
this.cfg_id = cfg_id;
}
public String getCfg_passwd() {
return cfg_passwd;
}
public void setCfg_passwd(String cfg_passwd) {
this.cfg_passwd = cfg_passwd;
}
public String getCfg_charset() {
return cfg_charset;
}
public void setCfg_charset(String cfg_charset) {
this.cfg_charset = cfg_charset;
}
public int getCfg_tenant_dbid() {
return cfg_tenant_dbid;
}
public void setCfg_tenant_dbid(int cfg_tenant_dbid) {
this.cfg_tenant_dbid = cfg_tenant_dbid;
}
public int getCfg_switch_dbid() {
return cfg_switch_dbid;
}
public void setCfg_switch_dbid(int cfg_switch_dbid) {
this.cfg_switch_dbid = cfg_switch_dbid;
}
@Override
public String toString() {
return "GenesysInfoVo [cfg_ip_p=" + cfg_ip_p + ", cfg_ip_b=" + cfg_ip_b + ", cfg_port_p=" + cfg_port_p
+ ", cfg_port_b=" + cfg_port_b + ", cfg_endpoint_p=" + cfg_endpoint_p + ", cfg_endpoint_b="
+ cfg_endpoint_b + ", cfg_client_name=" + cfg_client_name + ", cfg_tenant_dbid=" + cfg_tenant_dbid
+ ", cfg_switch_dbid=" + cfg_switch_dbid + ", cfg_id=" + cfg_id + ", cfg_passwd=" + cfg_passwd
+ ", cfg_charset=" + cfg_charset + "]";
}
}

View File

@ -0,0 +1,36 @@
package kr.co.i4way.genesys.model;
public class QueryVo {
String qry_type;
String qry_str;
int folder_type;
int folder_dbid;
public int getFolder_type() {
return folder_type;
}
public void setFolder_type(int folder_type) {
this.folder_type = folder_type;
}
public int getFolder_dbid() {
return folder_dbid;
}
public void setFolder_dbid(int folder_dbid) {
this.folder_dbid = folder_dbid;
}
public String getQry_type() {
return qry_type;
}
public void setQry_type(String qry_type) {
this.qry_type = qry_type;
}
public String getQry_str() {
return qry_str;
}
public void setQry_str(String qry_str) {
this.qry_str = qry_str;
}
}

View File

@ -0,0 +1,463 @@
package kr.co.i4way.genesys.ocserver;
import java.net.URI;
import java.net.URISyntaxException;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.commons.protocol.Endpoint;
import com.genesyslab.platform.commons.protocol.Message;
import com.genesyslab.platform.commons.protocol.ProtocolException;
import com.genesyslab.platform.commons.protocol.RegistrationException;
import com.genesyslab.platform.outbound.protocol.OutboundServerProtocol;
import com.genesyslab.platform.outbound.protocol.outboundserver.DialMode;
import com.genesyslab.platform.outbound.protocol.outboundserver.OptimizationMethod;
import com.genesyslab.platform.outbound.protocol.outboundserver.events.EventCampaignLoaded;
import com.genesyslab.platform.outbound.protocol.outboundserver.events.EventCampaignStatus;
import com.genesyslab.platform.outbound.protocol.outboundserver.events.EventCampaignUnloaded;
import com.genesyslab.platform.outbound.protocol.outboundserver.events.EventDialingStarted;
import com.genesyslab.platform.outbound.protocol.outboundserver.events.EventDialingStopped;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestForceUnloadCampaign;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestGetCampaignStatus;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestLoadCampaign;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestStartDialing;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestStopDialing;
import com.genesyslab.platform.outbound.protocol.outboundserver.requests.RequestUnloadCampaign;
public class CampaignCtrl {
URI outboundServerUri;
public OutboundServerProtocol outboundServerProtocol;
String ocServerUri = null;
String clientName = null;
String clientPw = null;
String appName = null;
String appPw = null;
public void initalize(String svrUri, String app_nm, String appPw, String cl_nm, String cl_pw){
ocServerUri = svrUri;
clientName = cl_nm;
clientPw = cl_pw;
appName = app_nm;
appPw = appPw;
}
public void openProtocol(){
try {
outboundServerUri = new URI(ocServerUri);
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
outboundServerProtocol =
new OutboundServerProtocol(
new Endpoint(
outboundServerUri));
outboundServerProtocol.setClientName(clientName);
outboundServerProtocol.setClientPassword(clientPw);
outboundServerProtocol.setUserName(appName);
outboundServerProtocol.setUserPassword(appPw);
try {
outboundServerProtocol.open();
} catch (RegistrationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void closeProtocol(){
if(outboundServerProtocol.getState() == ChannelState.Opened){
try {
outboundServerProtocol.close();
} catch (ProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public String getCampaignStat(int campaignDBID, int agentGroupDBID)
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestGetCampaignStatus req =
RequestGetCampaignStatus.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
Message msg = null;
try {
msg = outboundServerProtocol.request(req);
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
public String LoadCampaign(int campaignDBID, int agentGroupDBID)
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestLoadCampaign req =
RequestLoadCampaign.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
Message msg = null;
try {
msg = outboundServerProtocol.request( req );
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
public String UnloadCampaign(int campaignDBID, int agentGroupDBID)
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestUnloadCampaign req =
RequestUnloadCampaign.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
Message msg = null;
try {
msg = outboundServerProtocol.request( req );
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
public String ForceUnloadCampaign(int campaignDBID, int agentGroupDBID)
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestForceUnloadCampaign req =
RequestForceUnloadCampaign.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
Message msg = null;
try {
msg = outboundServerProtocol.request( req );
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
private OptimizationMethod GetOptimizationMethod( String strOptimizationMethod )
{
if(strOptimizationMethod.equals("BusyFactor")){
return OptimizationMethod.BusyFactor;
}else if(strOptimizationMethod.equals("OverdialRate")){
return OptimizationMethod.OverdialRate;
}else if(strOptimizationMethod.equals("WaitTime")){
return OptimizationMethod.WaitTime;
}else{
return OptimizationMethod.NoOptimizationMethod;
}
}
private DialMode GetDialingMode( String strDialMode )
{
if(strDialMode.equals("Predict")){
return DialMode.Predict;
}else if(strDialMode.equals("PredictAndSeize")){
return DialMode.PredictAndSeize;
}else if(strDialMode.equals("Preview")){
return DialMode.Preview;
}else if(strDialMode.equals("Progress")){
return DialMode.Progress;
}else if(strDialMode.equals("ProgressAndSeize")){
return DialMode.ProgressAndSeize;
}else{
return DialMode.NoDialMode;
}
}
public String StartDialing(int campaignDBID, int agentGroupDBID, String dialingMode, String optimizeMethod, int optimizeGoal )
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestStartDialing req =
RequestStartDialing.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
req.setDialMode(GetDialingMode(dialingMode));
req.setOptimizeBy(GetOptimizationMethod(optimizeMethod));
req.setOptimizeGoal(optimizeGoal);
Message msg = null;
try {
msg = outboundServerProtocol.request( req );
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
System.out.println(msg.messageId());
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
public String StopDialing(int campaignDBID, int agentGroupDBID)
{
String rtnval = "";
if(outboundServerProtocol.getState() == ChannelState.Opened){
RequestStopDialing req =
RequestStopDialing.create();
req.setCampaignId(campaignDBID);
req.setGroupId(agentGroupDBID);
Message msg = null;
try {
msg = outboundServerProtocol.request( req );
if ( msg != null && msg.messageId() == EventCampaignLoaded.ID )
{
EventCampaignLoaded evt = (EventCampaignLoaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStarted.ID )
{
EventDialingStarted evt = (EventDialingStarted)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventDialingStopped.ID )
{
EventDialingStopped evt = (EventDialingStopped)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignUnloaded.ID )
{
EventCampaignUnloaded evt = (EventCampaignUnloaded)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else if ( msg != null && msg.messageId() == EventCampaignStatus.ID )
{
EventCampaignStatus evt = (EventCampaignStatus)msg;
rtnval = evt.getGroupCampaignStatus().toString();
}
else
{
rtnval = "Error_4";
}
} catch (ProtocolException e) {
rtnval = "Error_1";
} catch (IllegalStateException e) {
rtnval = "Error_2";
}
}
else
{
rtnval = "Error_3";
}
return rtnval;
}
}

View File

@ -0,0 +1,229 @@
package kr.co.i4way.genesys.ocserver;
import java.util.Collection;
import com.genesyslab.platform.applicationblocks.com.ConfigException;
import com.genesyslab.platform.commons.protocol.ChannelState;
import com.genesyslab.platform.commons.protocol.ProtocolException;
import kr.co.i4way.genesys.ocserver.CampaignCtrl;
public class OutboundModule {
CampaignCtrl cc = null;
String ocSvrIp = "";
int ocSvrPort = 0;
String ocSvrId = "";
String ocSvrPasswd = "";
String ocClientName = "";
String ocClientPasswd = "";
String charSet = "";
/**
* .
* @param String svrIp CTI IP
* @param int svrPort CTI Port
* @param String charset
*/
public void setOcServerInfo(String svrIp, int svrPort, String charset){
ocSvrIp = svrIp;
ocSvrPort = svrPort;
ocSvrId = "ocserver";
ocSvrPasswd = null;
ocClientName = "default";
ocClientPasswd = "";
String mOCServerURI = "tcp://"+svrIp+":" + svrPort;
cc = new CampaignCtrl();
cc.initalize(mOCServerURI, ocSvrId, ocSvrPasswd, ocClientName, ocClientPasswd);
}
/**
* OutboundContact .
* @return boolean
*/
public boolean connectOcServer(){
boolean rtnval = false;
try {
if(cc != null){
cc.openProtocol();
if(cc.outboundServerProtocol != null) {
cc.outboundServerProtocol.getState().toString();
System.out.println("OcServer service Is Opend");
}else {
System.out.println("OcServer service Is null");
}
rtnval = true;
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = false;
}
return rtnval;
}
/**
* OutboundContact .
* @return boolean
*/
public boolean disConnectOcServer(){
boolean rtnval = false;
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
cc.closeProtocol();
System.out.println("OcServer service Is Closed");
rtnval = true;
}else{
System.out.println("OcServer service Already Close");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = false;
}
return rtnval;
}
/**
*
* @return boolean
*/
public String getCampaignStat(int campaignDBID, int agentGroupDBID){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.getCampaignStat(campaignDBID, agentGroupDBID);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
/**
*
* @return String
*/
public String loadCampaign(int campaignDBID, int agentGroupDBID){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.LoadCampaign(campaignDBID, agentGroupDBID);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
/**
*
* @return String
*/
public String unloadCampaign(int campaignDBID, int agentGroupDBID){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.UnloadCampaign(campaignDBID, agentGroupDBID);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
/**
*
* @return String
*/
public String forceUnloadCampaign(int campaignDBID, int agentGroupDBID){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.ForceUnloadCampaign(campaignDBID, agentGroupDBID);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
/**
*
* @return String
*/
public String startDialing(int campaignDBID, int agentGroupDBID, String dialingMode, String optimizeMethod, int optimizeGoal){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.StartDialing(campaignDBID, agentGroupDBID, dialingMode, optimizeMethod, optimizeGoal);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
/**
*
* @return String
*/
public String stopDialing(int campaignDBID, int agentGroupDBID){
String rtnval = "";
try {
if(cc != null){
if(cc.outboundServerProtocol.getState() == ChannelState.Opened){
rtnval = cc.StopDialing(campaignDBID, agentGroupDBID);
}else{
System.out.println("OcServer service is Not Opend");
}
}else{
System.out.println("cc is null");
}
} catch(Exception ex){
ex.printStackTrace();
rtnval = "";
}
return rtnval;
}
}

View File

@ -0,0 +1,20 @@
#Genesys Server Info
genesysinfo.cfg_ip_p=172.168.30.2
genesysinfo.cfg_ip_b=172.168.30.2
genesysinfo.cfg_port_p=2020
genesysinfo.cfg_port_b=2020
genesysinfo.cfg_endpoint_p=Cfg_EP_P
genesysinfo.cfg_endpoint_b=Cfg_EP_B
genesysinfo.cfg_client_name=default
genesysinfo.cfg_tenant_dbid=101
genesysinfo.cfg_switch_dbid=101
genesysinfo.cfg_id=default
genesysinfo.cfg_passwd=password
genesysinfo.cfg_charset=MS949
genesysinfo.oc_ip_p=172.168.30.2
genesysinfo.oc_port_p=7004
genesysinfo.oc_id=default
genesysinfo.oc_passwd=pwssword
genesysinfo.oc_client_id=
genesysinfo.oc_client_passwd=
genesysinfo.oc_charset=MS949

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.i4way.main.dao.MainDao">
<select id="getDual" resultType="java.lang.String">
SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24MISS') FROM DUAL
</select>
</mapper>

View File

@ -0,0 +1,13 @@
package kr.co.i4way.web;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GenWebApiApplicationTests {
@Test
void contextLoads() {
}
}