Commit 1048b1560018139c69f92a47275532dbb8fa81d8

Authored by Suraputt Suntimitr
1 parent a4b8a4b2
Exists in master and in 1 other branch INGW_CMF

Template

Showing 110 changed files with 12079 additions and 0 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 110 files displayed.

.classpath 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  5 + <classpathentry kind="lib" path="lib/gson-2.2.2.jar"/>
  6 + <classpathentry kind="lib" path="lib/simple-xml-2.7.1.jar"/>
  7 + <classpathentry kind="lib" path="lib/ec02_library.jar"/>
  8 + <classpathentry kind="lib" path="lib/eqxmsg_3_3_2.jar"/>
  9 + <classpathentry kind="lib" path="lib/org.json-20120521.jar"/>
  10 + <classpathentry kind="lib" path="lib/commons-log-pack-1.1.2.jar"/>
  11 + <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
  12 + <classpathentry kind="output" path="bin"/>
  13 +</classpath>
... ...
.gitignore 0 → 100644
... ... @@ -0,0 +1 @@
  1 +/bin/
... ...
.project 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>EQXTemplate</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.jdt.core.javabuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>org.eclipse.jdt.core.javanature</nature>
  16 + </natures>
  17 +</projectDescription>
... ...
CustomLog/PreReleasedTest.log_1 0 → 100644
... ... @@ -0,0 +1,275 @@
  1 +TRACE|09:28:16|Thread-0|testCustomLog|
  2 +TRACE|09:29:16|Thread-0|testCustomLog|
  3 +TRACE|09:29:17|Thread-0|testCustomLog|
  4 +TRACE|09:30:16|Thread-0|testCustomLog|
  5 +TRACE|09:30:17|Thread-0|testCustomLog|
  6 +TRACE|09:31:16|Thread-0|testCustomLog|
  7 +TRACE|09:32:16|Thread-0|testCustomLog|
  8 +TRACE|09:33:16|Thread-0|testCustomLog|
  9 +TRACE|09:34:16|Thread-0|testCustomLog|
  10 +TRACE|09:34:22|Thread-0|testCustomLog|
  11 +TRACE|09:35:16|Thread-0|testCustomLog|
  12 +TRACE|09:35:22|Thread-0|testCustomLog|
  13 +TRACE|09:35:26|Thread-0|testCustomLog|
  14 +TRACE|09:35:58|Thread-0|testCustomLog|
  15 +TRACE|09:36:16|Thread-0|testCustomLog|
  16 +TRACE|09:36:22|Thread-0|testCustomLog|
  17 +TRACE|09:36:26|Thread-0|testCustomLog|
  18 +TRACE|09:36:58|Thread-0|testCustomLog|
  19 +TRACE|09:37:16|Thread-0|testCustomLog|
  20 +TRACE|09:37:26|Thread-0|testCustomLog|
  21 +TRACE|09:37:58|Thread-0|testCustomLog|
  22 +TRACE|09:38:16|Thread-0|testCustomLog|
  23 +TRACE|09:38:26|Thread-0|testCustomLog|
  24 +TRACE|09:38:58|Thread-0|testCustomLog|
  25 +TRACE|09:39:16|Thread-0|testCustomLog|
  26 +TRACE|09:39:26|Thread-0|testCustomLog|
  27 +TRACE|09:39:58|Thread-0|testCustomLog|
  28 +TRACE|09:40:16|Thread-0|testCustomLog|
  29 +TRACE|09:40:26|Thread-0|testCustomLog|
  30 +TRACE|09:40:58|Thread-0|testCustomLog|
  31 +TRACE|09:41:16|Thread-0|testCustomLog|
  32 +TRACE|09:41:26|Thread-0|testCustomLog|
  33 +TRACE|09:41:56|Thread-0|testCustomLog|
  34 +TRACE|09:41:58|Thread-0|testCustomLog|
  35 +TRACE|09:42:16|Thread-0|testCustomLog|
  36 +TRACE|09:42:26|Thread-0|testCustomLog|
  37 +TRACE|09:42:58|Thread-0|testCustomLog|
  38 +TRACE|09:43:16|Thread-0|testCustomLog|
  39 +TRACE|09:43:26|Thread-0|testCustomLog|
  40 +TRACE|09:43:58|Thread-0|testCustomLog|
  41 +TRACE|09:44:16|Thread-0|testCustomLog|
  42 +TRACE|09:44:26|Thread-0|testCustomLog|
  43 +TRACE|09:44:37|Thread-0|testCustomLog|
  44 +TRACE|09:44:58|Thread-0|testCustomLog|
  45 +TRACE|09:45:16|Thread-0|testCustomLog|
  46 +TRACE|09:45:26|Thread-0|testCustomLog|
  47 +TRACE|09:45:37|Thread-0|testCustomLog|
  48 +TRACE|09:45:58|Thread-0|testCustomLog|
  49 +TRACE|09:46:16|Thread-0|testCustomLog|
  50 +TRACE|09:46:26|Thread-0|testCustomLog|
  51 +TRACE|09:46:37|Thread-0|testCustomLog|
  52 +TRACE|09:46:58|Thread-0|testCustomLog|
  53 +TRACE|09:47:16|Thread-0|testCustomLog|
  54 +TRACE|09:47:26|Thread-0|testCustomLog|
  55 +TRACE|09:47:37|Thread-0|testCustomLog|
  56 +TRACE|09:47:58|Thread-0|testCustomLog|
  57 +TRACE|09:48:16|Thread-0|testCustomLog|
  58 +TRACE|09:48:26|Thread-0|testCustomLog|
  59 +TRACE|09:48:58|Thread-0|testCustomLog|
  60 +TRACE|09:49:16|Thread-0|testCustomLog|
  61 +TRACE|09:49:26|Thread-0|testCustomLog|
  62 +TRACE|09:49:58|Thread-0|testCustomLog|
  63 +TRACE|09:50:16|Thread-0|testCustomLog|
  64 +TRACE|09:50:26|Thread-0|testCustomLog|
  65 +TRACE|09:50:58|Thread-0|testCustomLog|
  66 +TRACE|09:51:16|Thread-0|testCustomLog|
  67 +TRACE|09:51:26|Thread-0|testCustomLog|
  68 +TRACE|09:51:58|Thread-0|testCustomLog|
  69 +TRACE|09:52:16|Thread-0|testCustomLog|
  70 +TRACE|09:52:26|Thread-0|testCustomLog|
  71 +TRACE|09:52:58|Thread-0|testCustomLog|
  72 +TRACE|09:53:16|Thread-0|testCustomLog|
  73 +TRACE|09:53:26|Thread-0|testCustomLog|
  74 +TRACE|09:53:58|Thread-0|testCustomLog|
  75 +TRACE|09:54:16|Thread-0|testCustomLog|
  76 +TRACE|09:54:26|Thread-0|testCustomLog|
  77 +TRACE|09:54:58|Thread-0|testCustomLog|
  78 +TRACE|09:55:16|Thread-0|testCustomLog|
  79 +TRACE|09:55:26|Thread-0|testCustomLog|
  80 +TRACE|09:55:58|Thread-0|testCustomLog|
  81 +TRACE|09:56:16|Thread-0|testCustomLog|
  82 +TRACE|09:56:26|Thread-0|testCustomLog|
  83 +TRACE|09:56:58|Thread-0|testCustomLog|
  84 +TRACE|09:57:16|Thread-0|testCustomLog|
  85 +TRACE|09:57:26|Thread-0|testCustomLog|
  86 +TRACE|09:57:33|Thread-0|testCustomLog|
  87 +TRACE|09:57:58|Thread-0|testCustomLog|
  88 +TRACE|09:58:16|Thread-0|testCustomLog|
  89 +TRACE|09:58:25|Thread-0|testCustomLog|
  90 +TRACE|09:58:26|Thread-0|testCustomLog|
  91 +TRACE|09:58:29|Thread-0|testCustomLog|
  92 +TRACE|09:58:33|Thread-0|testCustomLog|
  93 +TRACE|09:58:58|Thread-0|testCustomLog|
  94 +TRACE|09:59:16|Thread-0|testCustomLog|
  95 +TRACE|09:59:25|Thread-0|testCustomLog|
  96 +TRACE|09:59:26|Thread-0|testCustomLog|
  97 +TRACE|09:59:29|Thread-0|testCustomLog|
  98 +TRACE|09:59:33|Thread-0|testCustomLog|
  99 +TRACE|09:59:58|Thread-0|testCustomLog|
  100 +TRACE|10:00:16|Thread-0|testCustomLog|
  101 +TRACE|10:00:25|Thread-0|testCustomLog|
  102 +TRACE|10:00:26|Thread-0|testCustomLog|
  103 +TRACE|10:00:29|Thread-0|testCustomLog|
  104 +TRACE|10:00:33|Thread-0|testCustomLog|
  105 +TRACE|10:00:58|Thread-0|testCustomLog|
  106 +TRACE|10:01:16|Thread-0|testCustomLog|
  107 +TRACE|10:01:25|Thread-0|testCustomLog|
  108 +TRACE|10:01:26|Thread-0|testCustomLog|
  109 +TRACE|10:01:29|Thread-0|testCustomLog|
  110 +TRACE|10:01:33|Thread-0|testCustomLog|
  111 +TRACE|10:01:58|Thread-0|testCustomLog|
  112 +TRACE|10:02:16|Thread-0|testCustomLog|
  113 +TRACE|10:02:25|Thread-0|testCustomLog|
  114 +TRACE|10:02:26|Thread-0|testCustomLog|
  115 +TRACE|10:02:29|Thread-0|testCustomLog|
  116 +TRACE|10:02:33|Thread-0|testCustomLog|
  117 +TRACE|10:02:58|Thread-0|testCustomLog|
  118 +TRACE|10:03:16|Thread-0|testCustomLog|
  119 +TRACE|10:03:25|Thread-0|testCustomLog|
  120 +TRACE|10:03:26|Thread-0|testCustomLog|
  121 +TRACE|10:03:29|Thread-0|testCustomLog|
  122 +TRACE|10:03:33|Thread-0|testCustomLog|
  123 +TRACE|10:03:58|Thread-0|testCustomLog|
  124 +TRACE|10:04:08|Thread-0|testCustomLog|
  125 +TRACE|10:04:16|Thread-0|testCustomLog|
  126 +TRACE|10:04:25|Thread-0|testCustomLog|
  127 +TRACE|10:04:26|Thread-0|testCustomLog|
  128 +TRACE|10:04:29|Thread-0|testCustomLog|
  129 +TRACE|10:04:33|Thread-0|testCustomLog|
  130 +TRACE|10:04:58|Thread-0|testCustomLog|
  131 +TRACE|10:05:08|Thread-0|testCustomLog|
  132 +TRACE|10:05:16|Thread-0|testCustomLog|
  133 +TRACE|10:05:25|Thread-0|testCustomLog|
  134 +TRACE|10:05:26|Thread-0|testCustomLog|
  135 +TRACE|10:05:29|Thread-0|testCustomLog|
  136 +TRACE|10:05:33|Thread-0|testCustomLog|
  137 +TRACE|10:05:58|Thread-0|testCustomLog|
  138 +TRACE|10:06:08|Thread-0|testCustomLog|
  139 +TRACE|10:06:16|Thread-0|testCustomLog|
  140 +TRACE|10:06:25|Thread-0|testCustomLog|
  141 +TRACE|10:06:26|Thread-0|testCustomLog|
  142 +TRACE|10:06:29|Thread-0|testCustomLog|
  143 +TRACE|10:06:33|Thread-0|testCustomLog|
  144 +TRACE|10:06:58|Thread-0|testCustomLog|
  145 +TRACE|10:07:08|Thread-0|testCustomLog|
  146 +TRACE|10:07:16|Thread-0|testCustomLog|
  147 +TRACE|10:07:25|Thread-0|testCustomLog|
  148 +TRACE|10:07:26|Thread-0|testCustomLog|
  149 +TRACE|10:07:29|Thread-0|testCustomLog|
  150 +TRACE|10:07:33|Thread-0|testCustomLog|
  151 +TRACE|10:07:58|Thread-0|testCustomLog|
  152 +TRACE|10:08:08|Thread-0|testCustomLog|
  153 +TRACE|10:08:16|Thread-0|testCustomLog|
  154 +TRACE|10:08:25|Thread-0|testCustomLog|
  155 +TRACE|10:08:26|Thread-0|testCustomLog|
  156 +TRACE|10:08:29|Thread-0|testCustomLog|
  157 +TRACE|10:08:33|Thread-0|testCustomLog|
  158 +TRACE|10:08:58|Thread-0|testCustomLog|
  159 +TRACE|10:09:08|Thread-0|testCustomLog|
  160 +TRACE|10:09:16|Thread-0|testCustomLog|
  161 +TRACE|10:09:25|Thread-0|testCustomLog|
  162 +TRACE|10:09:26|Thread-0|testCustomLog|
  163 +TRACE|10:09:29|Thread-0|testCustomLog|
  164 +TRACE|10:09:33|Thread-0|testCustomLog|
  165 +TRACE|10:09:58|Thread-0|testCustomLog|
  166 +TRACE|10:10:16|Thread-0|testCustomLog|
  167 +TRACE|10:10:25|Thread-0|testCustomLog|
  168 +TRACE|10:10:26|Thread-0|testCustomLog|
  169 +TRACE|10:10:29|Thread-0|testCustomLog|
  170 +TRACE|10:10:33|Thread-0|testCustomLog|
  171 +TRACE|10:10:58|Thread-0|testCustomLog|
  172 +TRACE|10:11:16|Thread-0|testCustomLog|
  173 +TRACE|10:11:24|Thread-0|testCustomLog|
  174 +TRACE|10:11:25|Thread-0|testCustomLog|
  175 +TRACE|10:11:26|Thread-0|testCustomLog|
  176 +TRACE|10:11:29|Thread-0|testCustomLog|
  177 +TRACE|10:11:33|Thread-0|testCustomLog|
  178 +TRACE|10:11:58|Thread-0|testCustomLog|
  179 +TRACE|10:12:16|Thread-0|testCustomLog|
  180 +TRACE|10:12:24|Thread-0|testCustomLog|
  181 +TRACE|10:12:25|Thread-0|testCustomLog|
  182 +TRACE|10:12:26|Thread-0|testCustomLog|
  183 +TRACE|10:12:29|Thread-0|testCustomLog|
  184 +TRACE|10:12:34|Thread-0|testCustomLog|
  185 +TRACE|10:12:58|Thread-0|testCustomLog|
  186 +TRACE|10:13:16|Thread-0|testCustomLog|
  187 +TRACE|10:13:24|Thread-0|testCustomLog|
  188 +TRACE|10:13:25|Thread-0|testCustomLog|
  189 +TRACE|10:13:26|Thread-0|testCustomLog|
  190 +TRACE|10:13:29|Thread-0|testCustomLog|
  191 +TRACE|10:13:34|Thread-0|testCustomLog|
  192 +TRACE|10:13:58|Thread-0|testCustomLog|
  193 +TRACE|10:14:16|Thread-0|testCustomLog|
  194 +TRACE|10:14:24|Thread-0|testCustomLog|
  195 +TRACE|10:14:25|Thread-0|testCustomLog|
  196 +TRACE|10:14:26|Thread-0|testCustomLog|
  197 +TRACE|10:14:29|Thread-0|testCustomLog|
  198 +TRACE|10:14:34|Thread-0|testCustomLog|
  199 +TRACE|10:14:58|Thread-0|testCustomLog|
  200 +TRACE|10:15:04|Thread-0|testCustomLog|
  201 +TRACE|10:15:16|Thread-0|testCustomLog|
  202 +TRACE|10:15:24|Thread-0|testCustomLog|
  203 +TRACE|10:15:25|Thread-0|testCustomLog|
  204 +TRACE|10:15:26|Thread-0|testCustomLog|
  205 +TRACE|10:15:29|Thread-0|testCustomLog|
  206 +TRACE|10:15:34|Thread-0|testCustomLog|
  207 +TRACE|10:15:37|Thread-0|testCustomLog|
  208 +TRACE|10:15:58|Thread-0|testCustomLog|
  209 +TRACE|10:16:04|Thread-0|testCustomLog|
  210 +TRACE|10:16:16|Thread-0|testCustomLog|
  211 +TRACE|10:16:24|Thread-0|testCustomLog|
  212 +TRACE|10:16:25|Thread-0|testCustomLog|
  213 +TRACE|10:16:26|Thread-0|testCustomLog|
  214 +TRACE|10:16:29|Thread-0|testCustomLog|
  215 +TRACE|10:16:34|Thread-0|testCustomLog|
  216 +TRACE|10:16:37|Thread-0|testCustomLog|
  217 +TRACE|10:16:58|Thread-0|testCustomLog|
  218 +TRACE|10:17:04|Thread-0|testCustomLog|
  219 +TRACE|10:17:16|Thread-0|testCustomLog|
  220 +TRACE|10:17:24|Thread-0|testCustomLog|
  221 +TRACE|10:17:25|Thread-0|testCustomLog|
  222 +TRACE|10:17:26|Thread-0|testCustomLog|
  223 +TRACE|10:17:29|Thread-0|testCustomLog|
  224 +TRACE|10:17:34|Thread-0|testCustomLog|
  225 +TRACE|10:17:58|Thread-0|testCustomLog|
  226 +TRACE|10:18:04|Thread-0|testCustomLog|
  227 +TRACE|10:18:16|Thread-0|testCustomLog|
  228 +TRACE|10:18:24|Thread-0|testCustomLog|
  229 +TRACE|10:18:25|Thread-0|testCustomLog|
  230 +TRACE|10:18:26|Thread-0|testCustomLog|
  231 +TRACE|10:18:29|Thread-0|testCustomLog|
  232 +TRACE|10:18:29|Thread-0|testCustomLog|
  233 +TRACE|10:18:34|Thread-0|testCustomLog|
  234 +TRACE|10:18:58|Thread-0|testCustomLog|
  235 +TRACE|10:19:04|Thread-0|testCustomLog|
  236 +TRACE|10:19:16|Thread-0|testCustomLog|
  237 +TRACE|10:19:24|Thread-0|testCustomLog|
  238 +TRACE|10:19:25|Thread-0|testCustomLog|
  239 +TRACE|10:19:26|Thread-0|testCustomLog|
  240 +TRACE|10:19:29|Thread-0|testCustomLog|
  241 +TRACE|10:19:34|Thread-0|testCustomLog|
  242 +TRACE|10:19:58|Thread-0|testCustomLog|
  243 +TRACE|10:20:04|Thread-0|testCustomLog|
  244 +TRACE|10:20:16|Thread-0|testCustomLog|
  245 +TRACE|10:20:24|Thread-0|testCustomLog|
  246 +TRACE|10:20:25|Thread-0|testCustomLog|
  247 +TRACE|10:20:26|Thread-0|testCustomLog|
  248 +TRACE|10:20:28|Thread-0|testCustomLog|
  249 +TRACE|10:20:29|Thread-0|testCustomLog|
  250 +TRACE|10:20:34|Thread-0|testCustomLog|
  251 +TRACE|10:20:59|Thread-0|testCustomLog|
  252 +TRACE|10:21:04|Thread-0|testCustomLog|
  253 +TRACE|10:21:16|Thread-0|testCustomLog|
  254 +TRACE|10:21:24|Thread-0|testCustomLog|
  255 +TRACE|10:21:25|Thread-0|testCustomLog|
  256 +TRACE|10:21:26|Thread-0|testCustomLog|
  257 +TRACE|10:21:29|Thread-0|testCustomLog|
  258 +TRACE|10:21:34|Thread-0|testCustomLog|
  259 +TRACE|10:21:59|Thread-0|testCustomLog|
  260 +TRACE|10:22:04|Thread-0|testCustomLog|
  261 +TRACE|10:22:16|Thread-0|testCustomLog|
  262 +TRACE|10:22:24|Thread-0|testCustomLog|
  263 +TRACE|10:22:25|Thread-0|testCustomLog|
  264 +TRACE|10:22:26|Thread-0|testCustomLog|
  265 +TRACE|10:22:29|Thread-0|testCustomLog|
  266 +TRACE|10:22:34|Thread-0|testCustomLog|
  267 +TRACE|10:22:59|Thread-0|testCustomLog|
  268 +TRACE|10:23:04|Thread-0|testCustomLog|
  269 +TRACE|10:23:16|Thread-0|testCustomLog|
  270 +TRACE|10:23:20|Thread-0|testCustomLog|
  271 +TRACE|10:23:24|Thread-0|testCustomLog|
  272 +TRACE|10:23:25|Thread-0|testCustomLog|
  273 +TRACE|10:23:26|Thread-0|testCustomLog|
  274 +TRACE|10:23:29|Thread-0|testCustomLog|
  275 +TRACE|10:23:34|Thread-0|testCustomLog|
... ...
CustomLog/PreReleasedTest.log_2 0 → 100644
... ... @@ -0,0 +1,54 @@
  1 +TRACE|10:53:57|Thread-0|testCustomLog|
  2 +TRACE|10:54:57|Thread-0|testCustomLog|
  3 +TRACE|10:55:18|Thread-0|testCustomLog|
  4 +TRACE|10:55:57|Thread-0|testCustomLog|
  5 +TRACE|10:56:18|Thread-0|testCustomLog|
  6 +TRACE|10:56:57|Thread-0|testCustomLog|
  7 +TRACE|10:57:09|Thread-0|testCustomLog|
  8 +TRACE|10:57:18|Thread-0|testCustomLog|
  9 +TRACE|10:57:57|Thread-0|testCustomLog|
  10 +TRACE|10:58:03|Thread-0|testCustomLog|
  11 +TRACE|10:58:09|Thread-0|testCustomLog|
  12 +TRACE|10:58:17|Thread-0|testCustomLog|
  13 +TRACE|10:58:18|Thread-0|testCustomLog|
  14 +TRACE|10:58:57|Thread-0|testCustomLog|
  15 +TRACE|10:59:03|Thread-0|testCustomLog|
  16 +TRACE|10:59:09|Thread-0|testCustomLog|
  17 +TRACE|10:59:17|Thread-0|testCustomLog|
  18 +TRACE|10:59:18|Thread-0|testCustomLog|
  19 +TRACE|10:59:57|Thread-0|testCustomLog|
  20 +TRACE|11:00:03|Thread-0|testCustomLog|
  21 +TRACE|11:00:09|Thread-0|testCustomLog|
  22 +TRACE|11:00:18|Thread-0|testCustomLog|
  23 +TRACE|11:00:57|Thread-0|testCustomLog|
  24 +TRACE|11:01:03|Thread-0|testCustomLog|
  25 +TRACE|11:01:09|Thread-0|testCustomLog|
  26 +TRACE|11:01:18|Thread-0|testCustomLog|
  27 +TRACE|11:01:57|Thread-0|testCustomLog|
  28 +TRACE|11:02:03|Thread-0|testCustomLog|
  29 +TRACE|11:02:09|Thread-0|testCustomLog|
  30 +TRACE|11:02:18|Thread-0|testCustomLog|
  31 +TRACE|11:02:57|Thread-0|testCustomLog|
  32 +TRACE|11:03:03|Thread-0|testCustomLog|
  33 +TRACE|11:03:09|Thread-0|testCustomLog|
  34 +TRACE|11:03:18|Thread-0|testCustomLog|
  35 +TRACE|11:03:57|Thread-0|testCustomLog|
  36 +TRACE|11:04:03|Thread-0|testCustomLog|
  37 +TRACE|11:04:09|Thread-0|testCustomLog|
  38 +TRACE|11:04:18|Thread-0|testCustomLog|
  39 +TRACE|11:04:57|Thread-0|testCustomLog|
  40 +TRACE|11:05:03|Thread-0|testCustomLog|
  41 +TRACE|11:05:09|Thread-0|testCustomLog|
  42 +TRACE|11:05:18|Thread-0|testCustomLog|
  43 +TRACE|11:05:57|Thread-0|testCustomLog|
  44 +TRACE|11:06:03|Thread-0|testCustomLog|
  45 +TRACE|11:06:09|Thread-0|testCustomLog|
  46 +TRACE|11:06:18|Thread-0|testCustomLog|
  47 +TRACE|11:06:57|Thread-0|testCustomLog|
  48 +TRACE|11:07:03|Thread-0|testCustomLog|
  49 +TRACE|11:07:09|Thread-0|testCustomLog|
  50 +TRACE|11:07:18|Thread-0|testCustomLog|
  51 +TRACE|11:07:57|Thread-0|testCustomLog|
  52 +TRACE|11:08:03|Thread-0|testCustomLog|
  53 +TRACE|11:08:09|Thread-0|testCustomLog|
  54 +TRACE|11:08:18|Thread-0|testCustomLog|
... ...
README.md
conf/WS1.EC02.SERV.0 0 → 100644
... ... @@ -0,0 +1,247 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinoxAS" />
  5 + <Application group="WS1" service="SERV" instance="0" />
  6 + <Listener port="20741" backlog="256"/>
  7 + <Library directory="/opt/equinoxAS/lib/" function="th.co.ais.ssbsrfc.control.mainAF" />
  8 + <ECProperties>
  9 + <ThreadPool value="5" />
  10 + <AutoCpuUtilize value="true"/>
  11 + <CpuUtilizeList value="4,5,6,7,8,9,10,11,12,13,14,15,16"/>
  12 + <JavaOption value="-server"/>
  13 + <JavaOption value="-XX:CompileThreshold=1000"/>
  14 + <JavaOption value="-XX:ThreadStackSize=65535"/>
  15 + <JavaOption value="-XX:MainThreadStackSize=65535"/>
  16 + <JavaOption value="-Xms1G"/>
  17 + <JavaOption value="-Xmx1G"/>
  18 + <JavaOption value="-Djavax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom=com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"/>
  19 + <JavaOption value="-Djava.version=1.6"/>
  20 + <JavaLibrary value="ec02_library.jar"/>
  21 + <JavaLibrary value="gson-2.2.2.jar"/>
  22 + <JavaLibrary value="simple-xml-2.7.1.jar"/>
  23 + <JavaLibrary value="commons-lang-2.6.jar" />
  24 + <!--
  25 + <JavaLibrary value="commons-log-1.0.6.jar" /><JavaLibrary value="commons-log-pack-1.0.6.jar" />
  26 + -->
  27 + <JavaLibrary value="commons-log-1.1.2.jar" />
  28 + <JavaLibrary value="commons-log-pack-1.1.2.jar" />
  29 + <JavaLibrary value="org.json-20120521.jar" />
  30 + <JavaLibrary value="INGW_CMF.jar" />
  31 + </ECProperties>
  32 + <EnvProperty>
  33 + <property name="a1" value="a1Value" />
  34 + </EnvProperty>
  35 + </cold>
  36 + <warm>
  37 + <StatInterval value="2" />
  38 + <HousekeeperInterval value="10" />
  39 + <RestartDelay value="10" />
  40 + <ServerMaxSession value="20" />
  41 + <ServerReadTimeout value="30" />
  42 + <ServerWriteTimeout value="30" />
  43 + <ServerIdleTimeout value="30" />
  44 + <Debug-Mode-Dev value="false" />
  45 + <Debug-Mode-QA value="true" />
  46 + <IncomingMsgDecode value="true" />
  47 + <OutgoingMsgEncode value="true" />
  48 + <IncomingMsgTrim value="false" />
  49 + <OutgoingMsgTrim value="true" />
  50 + <!-- Resource name of Group-->
  51 + <Node-Name-AEMF value="AEMF" />
  52 + <Node-Name-SDF value="SDF"/>
  53 + <Node-Name-SRFP value="SSBSRFP"/>
  54 + <Node-Name-LBSRFP value="SRFP"/>
  55 + <Node-Name-DAA value="PantrySRFC"/>
  56 + <Node-Name-PantrySRFC value="PantrySRFC"/>
  57 + <Node-Name-LBCF value="LBCF" />
  58 + <Node-Name-ES00 value="LBCF_FM"/>
  59 + <Node-Name-E01 value="E01"/>
  60 + <Node-Name-ES12 value="ES12" />
  61 + <Node-Name-ES22 value="ES22"/>
  62 + <Node-Name-LCR value="LBCF-LCR"/>
  63 + <Node-Name-LBCF value="LBCF"/>
  64 + <Node-Name-USMP value="USMP"/>
  65 + <Resource-Name-AEMF value="LBCF.ES04.AEMF"/>
  66 + <!--Resource-Name-SDF value="LBCF.ES04.SDF"/>
  67 + <Resource-Name-SRFP value="LBCF.ES04.SRFP"/-->
  68 + <Resource-Name-LBSRFP value="LBCF.ES04.LBSRFP"/>
  69 + <Resource-Name-ES00 value="LBCF.ES00.SERV"/>
  70 + <Resource-Name-ES22 value="LBCF.ES22.SERV.0"/>
  71 + <Resource-Name-DAA value="LBCF.ES04.PantrySRFC.0"/>
  72 + <Resource-Name-E01 value="0"/>
  73 + <Resource-Name-E01-SMSTemplate value="SMSTemplate"/>
  74 + <Resource-Name-BOS value="LBCF.ES04.BOS"/>
  75 + <Resource-Name-LCR value="LBCF.ES04.LCR"/>
  76 + <Resource-Name-USMP value="LBCF.ES04.USMP"/>
  77 + <!--Resource-Name-A value="WS1.ES04.A"/>
  78 + <Resource-Name-C value="WS1.ES04.C"/>
  79 + <Resource-Name-B value="WS1.ES04.B"/-->
  80 +
  81 + <Resource-Name-SRFC value="WS1.ES04.C"/>
  82 + <Resource-Name-SRFP value="WS1.ES04.A"/>
  83 + <Resource-Name-SDF value="WS1.ES04.B"/>
  84 + <Request-Timeout value="10" />
  85 + <Default-timeout value="10" />
  86 + <B-timeout value="10" />
  87 + <HTTP-B-timeout value="10" />
  88 + <Wait-Get-File-Timeout value="25"/>
  89 + <GET-Loan-Broker-Subscriber-Timeout value="10"/>
  90 + <POST-Loan-Broker-Subscriber-Timeout value="10"/>
  91 + <POST-Arm-Balance-Timeout value="10"/>
  92 + <POST-Arm-Top-Up-Timeout value="10"/>
  93 + <HTTP-timeout value="10"/>
  94 + <POST-Arm-Status-Timeout value="10"/>
  95 + <DAA-Write-File-Timeout value="10"/>
  96 + <GET-Generic-User-Profile-Timeout value="10"/>
  97 + <POST-Generic-User-Profile-Timeout value="10"/>
  98 + <Check-Resource-Timeout value="10"/>
  99 + <List-File-Timeout value="10"/>
  100 + <Create-Subscriber-Timeout value="10"/>
  101 + <PUT-Loan-Broker-Subscriber-Timeout value="10"/>
  102 + <POST-Arm-Repay-Timeout value="10"/>
  103 + <DAA-Close-File-Timeout value="10"/>
  104 + <GET-Arm-Event-Timeout value="10"/>
  105 + <DELETE-Arm-Balance-Timeout value="10"/>
  106 + <DELETE-Arm-Top-Up-Timeout value="10"/>
  107 + <DELETE-Arm-Status-Timeout value="10"/>
  108 + <DELETE-Arm-Balance-Timeout value="10"/>
  109 + <DELETE-Arm-Top-Up-Timeout value="10"/>
  110 + <DELETE-Arm-Status-Timeout value="10"/>
  111 + <PUT-Arm-Balance-Timeout value="10"/>
  112 + <PUT-Arm-Top-Up-Timeout value="10"/>
  113 + <PUT-Arm-Status-Timeout value="10"/>
  114 + <PUT-Arm-Balance-Timeout value="10"/>
  115 + <PUT-Arm-Top-Up-Timeout value="10"/>
  116 + <PUT-Arm-Status-Timeout value="10"/>
  117 + <POST-Balance-Notification-Timeout value="10"/>
  118 + <POST-Top-Up-Nofication-Timeout value="10"/>
  119 + <DELETE-Arm-Loan-Repay-Timeout value="10"/>
  120 + <POST-Reimbursement-Notification-Timeout value="10"/>
  121 + <InquiryVasSubscriber-Timeout value="10"/>
  122 + <SMS-DCN-Timeout value="10"/>
  123 + <GET-DS3-Common-Timeout value="10"/>
  124 + <POST-DS3-Common-Timeout value="10"/>
  125 + <PUT-DS3-Common-Timeout value="10"/>
  126 + <POST-Delivery-Report-Notification-Timeout value="10"/>
  127 + <POST-MO-Notification-Timeout value="10"/>
  128 + <Wait-Send-Confirmation-Message-Timeout value="10"/>
  129 + <POST-DAA-Activity-Timeout value="10"/>
  130 + <GET-Generic-User-Profile-Timeout value="10"/>
  131 + <Initial-Customer-Registration-Timeout value="10"/>
  132 + <Replace-E01-Session-Timeout value="10"/>
  133 + <Search-E01-Timeout value="10"/>
  134 + <Increase-E01-DAA-Timeout value="10"/>
  135 + <Wait-SMS-DRR-Timeout value="10"/>
  136 + <Wait-SMS-DUR-Timeout value="10"/>
  137 + <E01-Global-Balance-Min value="0"/>
  138 + <E01-Global-Balance-Max value="999999999"/>
  139 + <AEMF-Expiry-Time value="864000" />
  140 + <Armed-Event-Overlap-Time value="0" />
  141 + <SDF-Expiry-Time value="604800" />
  142 + <Loan-Profile-Expiry-Time value="86400" />
  143 + <!-- sec 60*60*24 = 86400 = 1 day -->
  144 + <DAA-File-Path value="/Share/ext" />
  145 + <Recovery-Low-Balance-File-Path value="/Share/rec/lowbalance" />
  146 + <Recovery-Top-Up-File-Path value="/Share/rec/topup" />
  147 + <Recovery-Reimbursement-File-Path value="/Share/rec/reimbursement" />
  148 + <Recovery-Customer-Response-File-Path value="/Share/rec/customerresponse" />
  149 + <Recovery-Delivery-Report-File-Path value="/Share/rec/deliveryreport" />
  150 + <USMP-UserName value="DAA" />
  151 + <USMP-OrderRef value="DAA" />
  152 + <USMP-OrderDesc value="DAAInquiryVAS" />
  153 + <Loan-Potential-Jobs-Timeout value="90" />
  154 + <!-- 864000 = 10 days -->
  155 + <Loan-Protential-Jobs-Interval value="30" />
  156 + <Arm-Events-Balance-Maximum-Retry value="3" />
  157 + <Arm-Events-Top-Up-Maximum-Retry value="3" />
  158 + <Arm-Events-Status-Maximum-Retry value="3" />
  159 + <Min-Dialogue-Id value="0" />
  160 + <Max-Dialogue-Id value="99" />
  161 + <POST-Reimbursement-Notification-Max-Retry value="2" />
  162 + <POST-Low-Balance-Notification-Max-Retry value="2" />
  163 + <POST-Top-Up-Notification-Max-Retry value="2" />
  164 + <POST-Delivery-Report-Notification-Max-Retry value="2" />
  165 + <POST-MO-Notification-Max-Retry value="2" />
  166 + <Loan-Add-Balance-Timeout value="172800" />
  167 + <!-- sec 60*60*24*2 = 86400 = 172800 day -->
  168 + <AEMF-Call-Back-Address value="LBCF101|LBCF102" />
  169 + <TORO-Customer-Id value="660000000000000"/>
  170 + <TORO-Sender-Name value="AIS3G"/>
  171 + <cpid value="1234567890"/>
  172 + <appid value="1234567890"/>
  173 + <partner value="1234567890"/>
  174 + <operid value="1234567890"/>
  175 + <Loan-SMS-Invite-Expire-Time value="15" />
  176 + <!-- 864000 = 24 h -->
  177 + <Get-Potential-URL-Delivery-Interval value="3600" />
  178 + <Check-Resource-URL value="http://10.252.160.130/fe-srfp/" />
  179 + <DAA-Callback-URL-Prefix value="https://iot-apigw.ais.co.th:80/media/ssb/" />
  180 + <File-Subscriber-List-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/SubscriberList.json?token=" />
  181 + <File-Recovery-Low-Balance-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/RecoveryLowBalance.json?token=" />
  182 + <File-Recovery-Top-Up-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/RecoveryTopup.json?token=" />
  183 + <File-Recovery-Reimbursement-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/RecoveryReimbursement.json?token=" />
  184 + <File-Recovery-Customer-Reply-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/RecoveryCustomerResponse.json?token=" />
  185 + <File-Recovery-Delivery-Report-URL value="https://iot-apigw.ais.co.th/media/LoanPotentials/Content/RecoveryDeliveryReport.json?token=" />
  186 + <Get-File-Error-Redirect-URL value="http://www.google.co.th/" />
  187 + <POST-DAA-Url value="https://10.104.240.136:14212/api/v1/daa" />
  188 + <POST-DAA-Activity-URL value="https://10.104.240.136:14212/api/v1/daa" />
  189 + <POST-InquiryVasSubscriber-URL value="http://10.13.163.28/vsmpinquirysub/Web/Services/SubscriberWebService.asmx" />
  190 + <DAA-Credentials-Login value="DAA" />
  191 + <DAA-Credentials-Password value="123456" />
  192 + <DAA-Repay-Workflow-Name value="WORKFLOW_REPAY" />
  193 + <DAA-Delivery-Report-Workflow-Name value="DAA-Delivery-Report-Workflow-Name" />
  194 + <Origin-Host value="srfc01" />
  195 + <Origin-Realm value="srfc.sand.ais.co.th" />
  196 + <AEMF-Expiry-Date-Inifinity value="22001231000000" />
  197 + <POST-DAA-Activity-so-mode value="Online" />
  198 + <POST-DAA-Activity-source-system value="LoanBroker" />
  199 + <POST-DAA-Activity-busi-code value="4001" />
  200 + <!-- end server config-->
  201 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG"/>
  202 + <AFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  203 + <LogMaxFileSize value="1GB" />
  204 + <!-- end server config-->
  205 + <!-- type: none, e164, imsi etc. -->
  206 + <Trace type="none" directory="/opt/equinoxAS/trace" filename="Test.trc" >
  207 + <Number value="66860500900" />
  208 + </Trace>
  209 + <AFLOG name="testCustomLog" >
  210 + <LogLevel value="FATAL|ERROR|WARN|INFO" />
  211 + <Filename value="PreReleasedTest.log" />
  212 + <TargetDirectory value="./CustomLog"/>
  213 + <LogPattern value="%p|%d{HH:mm:ss}|%t|%c{2}|%x%m%n" />
  214 + <RollingInterval value="4" />
  215 + <Encoding value="UTF-8" />
  216 + <DatePattern value="'_'yyyy-MM-dd-HH-mm" />
  217 + <Custom>
  218 + <property name="log4jProperty1" value="propValue" />
  219 + <property name="log4jProperty2" value="propValue" />
  220 + </Custom>
  221 + </AFLOG>
  222 + <Log-Enabled value="DETAIL|STAT|SUMMARY|ERROR" />
  223 + <!-- DETAIL|STAT|UDR|SUMMARY|ERROR -->
  224 + <Log-CDR-Enabled value="LOAN|TOPUP_AIRTIME|TOPUP_FEE|PREP" />
  225 + <!-- LOAN|TOPUP_AIRTIME|TOPUP_FEE|PREP -->
  226 + <Enable-Detail-Log-Raw-Data value="true" />
  227 + <DETAIL_LOG-Statistic-Enabled value="true" />
  228 + <DETAIL_LOG-RawData-Enabled value="true" />
  229 + <DETAIL_LOG-Data-Enabled value="true" />
  230 + <DETAIL_LOG-Scenario-Enabled value="true" />
  231 + <DETAIL_LOG-CurrentState-Enabled value="true" />
  232 + <DETAIL_LOG-NextState-Enabled value="true" />
  233 + <DETAIL_LOG-Enabled value="2" />
  234 + <!-- 0|1|2 -->
  235 + <Log-UDR value="UDR" />
  236 + <Log-Detail value="DETAIL" />
  237 + <Log-Summary value="SUMMARY" />
  238 + <Log-Error value="ERRORLOG" />
  239 + <CDR-Loan value="CDR_LOAN" />
  240 + <CDR-Topup-Airtime value="CDR_TOPUP_AIRTIME" />
  241 + <CDR-Topup-Fee value="CDR_TOPUP_FEE" />
  242 + <CDR-Prep value="CDR_PREP" />
  243 + <ArmEvents-Status-Retry-Count value="3" />
  244 + <ArmEvents-Balance-Retry-Count value="3" />
  245 + <ArmEvents-Topup-Retry-Count value="3" />
  246 + </warm>
  247 +</configuration>
... ...
example.msg/debug.diameter.xml 0 → 100644
... ... @@ -0,0 +1,119 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="SRFC.E11.0" via="SRFC.E11.0" session="661253615699453" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData orig="SRFC.ES07.OCF.0" name="DIAMETER" type="request" ctype="Specialized-Resource" to="SRFC.ES00" invoke="661253615699453:1124733943:898498675" ret="0">
  4 + <Session-Id value="0:2534867132:2015-11-04-110234" />
  5 + <Auth-Application-Id value="8676" />
  6 + <Origin-Host value="ocf01" />
  7 + <Origin-Realm value="ocf.sand.ais.co.th" />
  8 + <Destination-Realm value="srfc.sand.ais.co.th" />
  9 + <Auth-Request-Type value="2" />
  10 + <TORO-UI-Session-Treatment>
  11 + <Inband-Indicator value="1" />
  12 + <Wait-Result-Indicator value="0" />
  13 + <Session-Timeout value="10" />
  14 + <Outband-Channel value="0" />
  15 + </TORO-UI-Session-Treatment>
  16 + <TORO-Customer-Id value="661253615699453" />
  17 + <TORO-Subscription-Id>
  18 + <TORO-Subscription-Id-Type value="0" />
  19 + <TORO-Subscription-Id-Data value="66812553493" />
  20 + </TORO-Subscription-Id>
  21 + <TORO-Language-Preference value="2" />
  22 + <TORO-UI-Menu>
  23 + <Menu-Id value="10110" />
  24 + <Priority-Number value="0" />
  25 + <Menu-Unique-Identifier value="661253615699453|4001|3GPackFree10Hrs|20121201:110000|20121225:110000" />
  26 + </TORO-UI-Menu>
  27 + <TORO-UI-Inline-Parameter>
  28 + <Parameter-Name value="packageName" />
  29 + <Parameter-Value value="3G Package Unlimit 799Baht 4GB 30days" />
  30 + </TORO-UI-Inline-Parameter>
  31 + <TORO-UI-Inline-Parameter>
  32 + <Parameter-Name value="spName" />
  33 + <Parameter-Value value="awn" />
  34 + </TORO-UI-Inline-Parameter>
  35 + <TORO-UI-Inline-Parameter>
  36 + <Parameter-Name value="msisdn" />
  37 + <Parameter-Value value="66812553493" />
  38 + </TORO-UI-Inline-Parameter>
  39 + <TORO-UI-Inline-Parameter>
  40 + <Parameter-Name value="customerId" />
  41 + <Parameter-Value value="661253615699453" />
  42 + </TORO-UI-Inline-Parameter>
  43 + <TORO-UI-Inline-Parameter>
  44 + <Parameter-Name value="operid" />
  45 + <Parameter-Value value="52001" />
  46 + </TORO-UI-Inline-Parameter>
  47 + <TORO-UI-Inline-Parameter>
  48 + <Parameter-Name value="marketingName" />
  49 + <Parameter-Value value="CupC" />
  50 + </TORO-UI-Inline-Parameter>
  51 + <TORO-UI-Inline-Parameter>
  52 + <Parameter-Name value="counterName" />
  53 + <Parameter-Value value="3GPackFree10Hrs" />
  54 + </TORO-UI-Inline-Parameter>
  55 + <TORO-UI-Inline-Parameter>
  56 + <Parameter-Name value="counterValue" />
  57 + <Parameter-Value value="13333" />
  58 + </TORO-UI-Inline-Parameter>
  59 + <TORO-UI-Inline-Parameter>
  60 + <Parameter-Name value="usedCredit" />
  61 + <Parameter-Value value="15068" />
  62 + </TORO-UI-Inline-Parameter>
  63 + <TORO-UI-Inline-Parameter>
  64 + <Parameter-Name value="currentDate" />
  65 + <Parameter-Value value="20150919:122310" />
  66 + </TORO-UI-Inline-Parameter>
  67 + <TORO-UI-Inline-Parameter>
  68 + <Parameter-Name value="remainingBalance" />
  69 + <Parameter-Value value="1000" />
  70 + </TORO-UI-Inline-Parameter>
  71 + <TORO-UI-Inline-Parameter>
  72 + <Parameter-Name value="replenishValue" />
  73 + <Parameter-Value value="59999" />
  74 + </TORO-UI-Inline-Parameter>
  75 + <TORO-UI-Inline-Parameter>
  76 + <Parameter-Name value="nextLowerThreshold" />
  77 + <Parameter-Value value="50" />
  78 + </TORO-UI-Inline-Parameter>
  79 + <TORO-UI-Inline-Parameter>
  80 + <Parameter-Name value="counterExpiryDate" />
  81 + <Parameter-Value value="20130331:090500" />
  82 + </TORO-UI-Inline-Parameter>
  83 + <TORO-UI-Inline-Parameter>
  84 + <Parameter-Name value="packageSpeed" />
  85 + <Parameter-Value value="30000000" />
  86 + </TORO-UI-Inline-Parameter>
  87 + <TORO-UI-Inline-Parameter>
  88 + <Parameter-Name value="sgw" />
  89 + <Parameter-Value value="abc" />
  90 + </TORO-UI-Inline-Parameter>
  91 + <TORO-UI-Inline-Parameter>
  92 + <Parameter-Name value="language" />
  93 + <Parameter-Value value="eng" />
  94 + </TORO-UI-Inline-Parameter>
  95 + <TORO-UI-Inline-Parameter>
  96 + <Parameter-Name value="ssid" />
  97 + <Parameter-Value value="abc" />
  98 + </TORO-UI-Inline-Parameter>
  99 + <TORO-UI-Inline-Parameter>
  100 + <Parameter-Name value="scpid" />
  101 + <Parameter-Value value="abc" />
  102 + </TORO-UI-Inline-Parameter>
  103 + <TORO-UI-Inline-Parameter>
  104 + <Parameter-Name value="locationNo" />
  105 + <Parameter-Value value="6692301735" />
  106 + </TORO-UI-Inline-Parameter>
  107 + <TORO-UI-Inline-Parameter>
  108 + <Parameter-Name value="TBCF" />
  109 + <Parameter-Value value="0" />
  110 + </TORO-UI-Inline-Parameter>
  111 + <TORO-UI-Inline-Parameter>
  112 + <Parameter-Name value="typeOfPackage" />
  113 + <Parameter-Value value="monetary" />
  114 + </TORO-UI-Inline-Parameter>
  115 + </EquinoxRawData>
  116 + <EquinoxInstance>
  117 + <value val="" />
  118 + </EquinoxInstance>
  119 +</EquinoxMessage>
0 120 \ No newline at end of file
... ...
example.msg/debug.html-text-plain.xml 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="LBCF.E11.0" via="LBCF.E11.0" session="66616820386" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData orig="LBCF.ES05.AEMF.0" name="HTTP" invoke="289546364" type="request" method="POST" url="/v1/aemf/MSISDN/66616820386/lowbalance.json" ctype="text/plain" val="{&quot;transactionID&quot;:&quot;smppgw-lowbalance-123456789101112&quot;,&quot;date&quot;:&quot;2014-11-04 20:00:00&quot;,&quot;achieve&quot;:&quot;target&quot;,&quot;feed&quot;:{&quot;lowBalanceAmount&quot;:&quot;20.00&quot;}}" to="LBCF.ES00" ret="0" />
  4 + <EquinoxInstance>
  5 + <value val="" />
  6 + </EquinoxInstance>
  7 +</EquinoxMessage>
0 8 \ No newline at end of file
... ...
example.msg/debug.html-text-xml-header.xml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="LBCF.E11.0" via="LBCF.E11.0" session="HH7LVFXT7KZF3O02IJC8" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData orig="LBCF.ES05.SRFP.0" name="HTTP" invoke="312534849" type="request" method="GET" url="/api/v1/LoanPotentials/content/getSubscriberList.json" ctype="text/xml" to="LBCF.ES00" ret="0">
  4 + <ERDHeader>
  5 + <Header name="Host" value="127.0.0.1:8877" />
  6 + <Header name="Pragma" value="no-cache" />
  7 + <Header name="Content-Type" value="application/json" />
  8 + <Header name="x-session-id" value="HH7LVFXT7KZF3O02IJC8" />
  9 + <Header name="x-msisdn" value="" />
  10 + <Header name="x-app" value="pantry-site-id=Site-T1; pantry-id=ID-T1; partnerID=9999; appKeyName=Flow GenerateClientID|ANDROIN|V2" />
  11 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,*/*" />
  12 + <Header name="Content-Length" value="0" />
  13 + <Header name="REMOTE_ADDR" value="127.0.0.1" />
  14 + </ERDHeader>
  15 + <ERDData value="/api/v1/LoanPotentials/content/getSubscriberList.json" />
  16 + </EquinoxRawData>
  17 + <EquinoxInstance>
  18 + <value val="" />
  19 + </EquinoxInstance>
  20 +</EquinoxMessage>
0 21 \ No newline at end of file
... ...
example.msg/debug.html-text-xml.xml 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="LBCF.E11.0" via="LBCF.E11.0" session="66616820386" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData orig="LBCF.ES04.LBSRFP.0" to="LBCF.ES00.SERV" name="HTTP" type="response" ctype="text/xml" invoke="SRFP.66616820386.SMS DCN.Incoming_SRFP_DCN_Response.bad8a7f4-026f-4bac-bbed-1dbea22627ea" ecode="200" method="POST" url="/" ret="0">
  4 + <Command-Name value="Dialogue-Change" />
  5 + <Session-Id value="66616820386" />
  6 + <Auth-Application-Id value="8679" />
  7 + <Auth-Request-Type value="2" />
  8 + <Result-Code value="2001" />
  9 + <Origin-Host value="srfp01" />
  10 + <Origin-Realm value="srfp.sand.ais.co.th" />
  11 + </EquinoxRawData>
  12 + <EquinoxInstance>
  13 + <value val="" />
  14 + </EquinoxInstance>
  15 +</EquinoxMessage>
0 16 \ No newline at end of file
... ...
example.msg/debug.ldap.xml 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="OMF.E11.0" via="OMF.E11.0" session="1:OMF.ES05.AAF.0" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData to="OMF.ES03.AMF.0" invoke="AMF.1:OMFES05AAF0.ConvergeSub.Incoming_CONVERGE_SUB_Response.4bce1259-d914-4afb-9e54-08798cfb8204" oid="0.0.17.1218.8.7.7" name="LDAP" ctype="extended" type="request" >
  4 + <AVP type="methodVersion">
  5 + <vals value="1"/>
  6 + </AVP>
  7 + <AVP type="subscriptionId">
  8 + <vals value="0|66845441234"/>
  9 + </AVP>
  10 + <AVP type="subscriptionId">
  11 + <vals value="1|52006898302225"/>
  12 + </AVP>
  13 + <AVP type="subscriptionId">
  14 + <vals value="1|52004898302226"/>
  15 + </AVP>
  16 + <AVP type="subscriptionId">
  17 + <vals value="1|52004898302227"/>
  18 + </AVP>
  19 + <AVP type="subscriptionId">
  20 + <vals value="1|52004898302228"/>
  21 + </AVP>
  22 + <AVP type="subscriptionId">
  23 + <vals value="1|52004898302229"/>
  24 + </AVP>
  25 + </EquinoxRawData>
  26 + <EquinoxInstance>
  27 + <value val="" />
  28 + </EquinoxInstance>
  29 +</EquinoxMessage>
0 30 \ No newline at end of file
... ...
example.msg/debug.xml 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<EquinoxMessage from="WS1.E11.0" via="WS1.E11.0" session="BX15GTBB8FK5T7H2C0TW" timeout="10" ret="0" diag="">
  3 + <EquinoxRawData orig="WS1.ES04.B.0" to="WS1.ES00.0" name="HTTP" type="response" ctype="text/xml" invoke="B.SESSION.Test B.Incoming_Adjustment_ChargeRequest_Response.140d8c8e-bb2b-48ba-ae0a-e9de3191febc" ecode="200" method="POST" url="/" ret="0">
  4 + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  5 + <soapenv:Body>
  6 + <ars:AdjustmentResultMsg xmlns:ars="http://www.huawei.com/bme/cbsinterface/arservices" xmlns:arc="http://cbs.huawei.com/ar/wsservice/arcommon" xmlns:cbs="http://www.huawei.com/bme/cbsinterface/cbscommon">
  7 + <ResultHeader>
  8 + <cbs:Version>1</cbs:Version>
  9 + <cbs:ResultCode>0</cbs:ResultCode>
  10 + <cbs:MsgLanguageCode>2002</cbs:MsgLanguageCode>
  11 + <cbs:ResultDesc>Operation successfully.</cbs:ResultDesc>
  12 + </ResultHeader>
  13 + <AdjustmentResult>
  14 + <ars:AcctKey>7805693</ars:AcctKey>
  15 + <ars:AdjustmentInfo>
  16 + <arc:BalanceType>C_MAIN_ACCOUNT</arc:BalanceType>
  17 + <arc:BalanceID>2550007807518</arc:BalanceID>
  18 + <arc:BalanceTypeName>MainAccount</arc:BalanceTypeName>
  19 + <arc:OldBalanceAmt>31183</arc:OldBalanceAmt>
  20 + <arc:NewBalanceAmt>32183</arc:NewBalanceAmt>
  21 + <arc:CurrencyID>1049</arc:CurrencyID>
  22 + </ars:AdjustmentInfo>
  23 + </AdjustmentResult>
  24 + </ars:AdjustmentResultMsg>
  25 + </soapenv:Body>
  26 + </soapenv:Envelope>
  27 + </EquinoxRawData>
  28 + <EquinoxInstance>
  29 + <value val="ACTIVE::eJx9kctugzAURH8l8jpYNgnIsIPETalU0mKiLJGBG+o24BRMuojy7zV9qItW3VmjGc8Z3Qtq1koedTNCUqPQoXNUqyrpzvoFUHhBMRZciGSb4hwGM4tx0lW6VV1TRPXzOJgWOlOsnmTfQAavo/UUGQwn3Q2A6ZLUrGLglKVbOktWSkcCkQ4ENSxoQA9QVlPH4ajfUDg1S2NLkUuoTzzKZiQIXT90KWYLgq7X+Y9T96qxzr2gmAvi4QgTNEfqCxt5zFsGzCXMitXY9xZSmM/P90W0vtuJ/J6necbFwzYVvFjdRtmGZ/xxx0VuM6cezkqPw3co5psktboeTaPt+A89Vy3YR3v6EznwFzYwGNmbG0v9v3naN+ErY2+R/F5xfQdXWX6o::1" />
  30 + </EquinoxInstance>
  31 +</EquinoxMessage>
0 32 \ No newline at end of file
... ...
lib/commons-lang-2.6.jar 0 → 100644
No preview for this file type
lib/commons-log-pack-1.1.2.jar 0 → 100644
No preview for this file type
lib/ec02_library.jar 0 → 100644
No preview for this file type
lib/eqxmsg_3_3_2.jar 0 → 100644
No preview for this file type
lib/gson-2.2.2.jar 0 → 100644
No preview for this file type
lib/org.json-20120521.jar 0 → 100644
No preview for this file type
lib/simple-xml-2.7.1.jar 0 → 100644
No preview for this file type
src/th/co/ais/ssbsrfc/config/Constant.java 0 → 100644
... ... @@ -0,0 +1,144 @@
  1 +package th.co.ais.ssbsrfc.config;
  2 +
  3 +
  4 +
  5 +public class Constant {
  6 +
  7 + /*
  8 + * [mSSB-SRFC] [Send|Received] [Bad] <CommandName> [Response|Request] [Timeout|Abort|Reject|Error]
  9 + */
  10 +
  11 + public static final int TYPE_SEND = 0;
  12 + public static final int TYPE_RECEIVE = 1;
  13 +
  14 + public static final int TYPE_RESPONSE = 2;
  15 + public static final int TYPE_REQUEST = 3;
  16 + public static final int TYPE_NOREPLY = 88;
  17 +
  18 + public static final int TYPE_MISSING = 4;
  19 + public static final int TYPE_INVALID = 5;
  20 +
  21 + public static final int TYPE_TIMEOUT = 6;
  22 + public static final int TYPE_ABORT = 7;
  23 + public static final int TYPE_REJECT = 8;
  24 + public static final int TYPE_ERROR = 9;
  25 +
  26 +
  27 + public static final int TYPE_SUCCESS = 10;
  28 + public static final int TYPE_UNKNOWN_ERROR = 12;
  29 + public static final int TYPE_MENU_UNIQUELDENTIFIER_DUPLICATE = 100;
  30 + public static final int TYPE_CHANNEL = 101;
  31 +
  32 +
  33 + public static final int TYPE_DATA_NOT_FOUND = 11;
  34 + public static final int TYPE_SUCCESS_WITH_CONDITION = 13;
  35 + public static final int TYPE_SUCCESS_WITH_CONDITION_STATUS_CHANGE = 14;
  36 + public static final int TYPE_REJECT_APPLICATION = 15;
  37 + public static final int TYPE_SUCCESS_WITH_CONDITION_STATUS_TERMINATED = 16;
  38 + public static final int TYPE_SUCCESS_WITH_CONDITION_STATUS_BORROWED = 17;
  39 + public static final int TYPE_SUCCESS_WITH_CONDITION_OUTSTANDING_NOT_ZERO = 18;
  40 + public static final int TYPE_SUCCESS_WITH_CONDITION_NOT_IN_SEVEN_DAYS = 19;
  41 + public static final int TYPE_USER_INACTIVE = 20;
  42 + public static final int TYPE_INVALID_CONTRACT_ID = 21;
  43 + public static final int TYPE_ACCESS_DENIED = 22;
  44 + public static final int TYPE_FILE_NOT_FOUND = 23;
  45 + public static final int TYPE_ALREADY_SENT_INVITATION = 24;
  46 + public static final int TYPE_ALREADY_SENT_ADD_BALANCE = 25;
  47 + public static final int TYPE_DATA_EXISTED = 26;
  48 + public static final int TYPE_DUPLICATE = 99;
  49 +
  50 + public static final String SEND = "Send";
  51 + public static final String RECEIVE = "Receive";
  52 +
  53 + public static final String BAD = "Bad";
  54 + public static final String DUPLICATE = "Duplicate";
  55 +
  56 + public static final String RESPONSE = "Response";
  57 + public static final String REQUEST = "Request";
  58 +
  59 + public static final String TIMEOUT = "Timeout";
  60 + public static final String ABORT = "Abort";
  61 + public static final String REJECT = "Reject";
  62 + public static final String ERROR = "Error";
  63 +
  64 + public static final String ENCRYPTKEY = "82BDZsTKxvTJb9Bm";
  65 +
  66 + public static final int FLOW_TEST_A = 1;
  67 + public static final int FLOW_Unexpected_Event_Handling = 19;
  68 +
  69 + public static final int SUBSTATE_TYPE_W_REQUEST = 1;
  70 + public static final int SUBSTATE_TYPE_W_RESPONSE = 2;
  71 + public static final int SUBSTATE_TYPE_W_E01 = 3;
  72 + public static final int SUBSTATE_TYPE_UNKNOWN = -1;
  73 +
  74 + public static String nodeLBSRFP = "LBSRFP";
  75 + public static String nodeE01 = "E01";
  76 + public static String nodeES12 = "ES12";
  77 +
  78 + public static final int[] arrSingleFlow = {/*Constant.FLOW_Loan_Potential_Jobs_Tracking, Constant.FLOW_TEST_A, Constant.FLOW_Loan_Potential_Request_Handling, Constant.FLOW_Loan_UI, Constant.FLOW_Loan_Activation, Constant.FLOW_Loan_Customer_Registration*/};
  79 +
  80 + public static enum DETAILLOG {
  81 + CLOSE(0),
  82 + OPENERROR(1),
  83 + OPEN(2),
  84 + ;
  85 +
  86 + int num = 0;
  87 + DETAILLOG(int message){
  88 + this.num = message;
  89 + }
  90 + public int get(){
  91 + return this.num;
  92 + }
  93 +
  94 + }
  95 +
  96 + public static enum ValidateType {
  97 + STRING,
  98 + NUMBER,
  99 + CURRENCY,
  100 + MOBILE,
  101 + DATETIME,
  102 + BOOLEAN,
  103 + BOOLEANUPPERCASE,
  104 + FIX,
  105 +// LANG,
  106 + YESNO,
  107 + DECIMAL,
  108 + OBJECT,
  109 + ARRAY,
  110 +// SUBSCRIPTIONSTATE,
  111 +// AEMFCHARACTERISTIC,
  112 +// AEMFVALUETYPE,
  113 +// AEMFALERTPOINT,
  114 +// AMFLOANSTATE,
  115 + URL,
  116 + EMAIL,
  117 +// DS3CUSTOMERCATEGORY,
  118 +// DS3CUSTOMERSUBCATEGORY,
  119 +// DS3CUSTOMERSEGMENT,
  120 +// AEMFACHIEVE,
  121 +// AEMFSTATUS,
  122 +// AEMFSTATUS2,
  123 +// ARMEDPARAM,
  124 +// SDFGUPDATASERVLIFESTYLE,
  125 +// SDFGUPAUTHENLEVEL,
  126 +// MOBILESTATUS,
  127 +// LANGUPPER,
  128 +// DAAERRORCODE,
  129 + NOTCHECKINVALID,
  130 + TOROSUBSCRIPTIONIDTYPE,
  131 + BEARERTYPE,
  132 + OutbandChannel,
  133 + REESULTCODE,
  134 + WAITRESULTINDICATOR,
  135 + OUTBANDCHANNELOTP,
  136 + TOROLANGUAGEPREFERENCE,
  137 + INBANDINDICATOR
  138 + }
  139 +
  140 + public static enum Parameter {
  141 + MANDATORY,
  142 + OPTIONAL
  143 + }
  144 +}
... ...
src/th/co/ais/ssbsrfc/config/EventFilter.java 0 → 100644
... ... @@ -0,0 +1,58 @@
  1 +package th.co.ais.ssbsrfc.config;
  2 +
  3 +public class EventFilter {
  4 + public String eventType;
  5 + public String type;
  6 + public String ctype;
  7 + public String method;
  8 + public String getEventType() {
  9 + return eventType;
  10 + }
  11 +
  12 + public void setEventType(String eventType) {
  13 + this.eventType = eventType;
  14 + }
  15 +
  16 + public String getType() {
  17 + return type;
  18 + }
  19 +
  20 + public void setType(String type) {
  21 + this.type = type;
  22 + }
  23 +
  24 + public String getCtype() {
  25 + return ctype;
  26 + }
  27 +
  28 + public void setCtype(String ctype) {
  29 + this.ctype = ctype;
  30 + }
  31 +
  32 + public String getMethod() {
  33 + return method;
  34 + }
  35 +
  36 + public void setMethod(String method) {
  37 + this.method = method;
  38 + }
  39 +
  40 + public String getCmd() {
  41 + return cmd;
  42 + }
  43 +
  44 + public void setCmd(String cmd) {
  45 + this.cmd = cmd;
  46 + }
  47 +
  48 + public String cmd;
  49 +
  50 + public EventFilter(String _eventType, String _type, String _ctype, String _method, String _cmd)
  51 + {
  52 + this.eventType = _eventType;
  53 + this.type = _type;
  54 + this.ctype = _ctype;
  55 + this.method = _method;
  56 + this.cmd = _cmd;
  57 + }
  58 +}
... ...
src/th/co/ais/ssbsrfc/config/Invoke.java 0 → 100644
... ... @@ -0,0 +1,136 @@
  1 +package th.co.ais.ssbsrfc.config;
  2 +
  3 +import java.util.UUID;
  4 +
  5 +import th.co.ais.ssbsrfc.utils.Global;
  6 +
  7 +public class Invoke {
  8 + public String nodeName; // UDC, SRFC, SDF
  9 + public String key; // 6681234567
  10 + public String cmd = null; // callBackUrl, getFile
  11 + public String eventType = null; // Incoming_UDC_Response
  12 + public String unique;
  13 + public Object dev = null; // for developer
  14 +
  15 + private static final String DELIMITER = ".";
  16 +
  17 + public String getNodeName() {
  18 + return nodeName;
  19 + }
  20 +
  21 + public void setNodeName(String nodeName) {
  22 + this.nodeName = nodeName;
  23 + }
  24 +
  25 + public String getKey() {
  26 + return key;
  27 + }
  28 +
  29 + public void setKey(String key) {
  30 + this.key = key;
  31 + }
  32 +
  33 + public String getCmd() {
  34 + return cmd;
  35 + }
  36 +
  37 + public void setCmd(String cmd) {
  38 + this.cmd = cmd;
  39 + }
  40 +
  41 + public String getUnique() {
  42 + return unique;
  43 + }
  44 +
  45 + public String getEventType() {
  46 + return eventType;
  47 + }
  48 +
  49 + public void setEventType(String eventType) {
  50 + this.eventType = eventType;
  51 + }
  52 +
  53 + public void setUnique(String unique) {
  54 + this.unique = unique;
  55 + }
  56 +
  57 + public static String genUniqueId()
  58 + {
  59 + UUID uuid = UUID.randomUUID();
  60 + return uuid.toString();
  61 + }
  62 +
  63 + public Object getDev() {
  64 + return dev;
  65 + }
  66 +
  67 + public void setDev(Object dev) {
  68 + this.dev = dev;
  69 + }
  70 +
  71 + public Invoke() {}
  72 +
  73 + public Invoke(String invokeString)
  74 + {
  75 + String[] strSplit = null;
  76 + if(invokeString != null)
  77 + {
  78 + strSplit = invokeString.split("[\\"+DELIMITER+"]");
  79 + if(strSplit.length == 5)
  80 + {
  81 + this.nodeName = strSplit[0];
  82 + this.key = strSplit[1];
  83 + this.cmd = strSplit[2];
  84 + this.eventType = strSplit[3];
  85 + this.unique = strSplit[4];
  86 + } else if (strSplit.length == 6) {
  87 + this.nodeName = strSplit[0];
  88 + this.key = strSplit[1];
  89 + this.cmd = strSplit[2];
  90 + this.eventType = strSplit[3];
  91 + this.unique = strSplit[4];
  92 + this.dev = strSplit[5];
  93 + }
  94 + }
  95 + }
  96 +
  97 + public Invoke(String _key, String _eventType) {
  98 + super();
  99 + String _cmd = StateConfig.getCommandFromEventType(eventType);
  100 + String _node = Global.getNodeFromEventType(eventType);
  101 + this.nodeName = _node;
  102 + this.key = _key;
  103 + this.cmd = _cmd;
  104 + this.eventType = _eventType;
  105 + UUID uuid = UUID.randomUUID();
  106 + this.unique = uuid.toString();
  107 + }
  108 +
  109 + public Invoke(String _nodeName, String _key, String _cmd, String _eventType, String _unique)
  110 + {
  111 + // TODO check . in all variable (if have)
  112 + this.nodeName = _nodeName;
  113 + this.key = _key;
  114 + this.cmd = _cmd;
  115 + this.eventType = _eventType;
  116 + if(_unique == null)
  117 + {
  118 + UUID uuid = UUID.randomUUID();
  119 + this.unique = uuid.toString();
  120 + }
  121 + else
  122 + {
  123 + this.unique = _unique;
  124 + }
  125 + }
  126 +
  127 + public String toString()
  128 + {
  129 + String strInvoke ="";
  130 + strInvoke = this.nodeName + DELIMITER + this.key + DELIMITER + this.cmd + DELIMITER + this.eventType + DELIMITER + this.unique;
  131 + if(this.dev != null) {
  132 + strInvoke += DELIMITER + this.dev.toString();
  133 + }
  134 + return strInvoke;
  135 + }
  136 +}
... ...
src/th/co/ais/ssbsrfc/config/State.java 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +package th.co.ais.ssbsrfc.config;
  2 +
  3 +public class State {
  4 + public String name;
  5 + public String eventType;
  6 + public String nameReq; //Log, Alarm, Stat, Error
  7 + public String nameRes; //Log, Alarm, Stat, Error
  8 + public int msgType;
  9 + public int flow = -1;
  10 +
  11 + public State(String _stateName, String _stateEventType, String _stateLASEName)
  12 + {
  13 + this.name = _stateName;
  14 + this.eventType = _stateEventType;
  15 + this.nameReq = _stateLASEName;
  16 + }
  17 +
  18 + public State(String _stateName, String _stateEventType, String _nameReq, String _nameRes, int _msgType)
  19 + {
  20 + this.name = _stateName;
  21 + this.eventType = _stateEventType;
  22 + this.nameReq = _nameReq;
  23 + this.nameRes = _nameRes;
  24 + this.msgType = _msgType;
  25 + }
  26 +
  27 + public State(String _stateName, String _stateEventType, String _nameReq, String _nameRes, int _msgType, int flow)
  28 + {
  29 + this.name = _stateName;
  30 + this.eventType = _stateEventType;
  31 + this.nameReq = _nameReq;
  32 + this.nameRes = _nameRes;
  33 + this.msgType = _msgType;
  34 + this.flow = flow;
  35 + }
  36 +
  37 + public String getName() {
  38 + return name;
  39 + }
  40 +
  41 + public void setName(String name) {
  42 + this.name = name;
  43 + }
  44 +
  45 + public String getEventType() {
  46 + return eventType;
  47 + }
  48 +
  49 + public void setEventType(String eventType) {
  50 + this.eventType = eventType;
  51 + }
  52 +
  53 + public String getLASEName() {
  54 + return nameReq;
  55 + }
  56 +
  57 + public void setLASEName(String lASEName) {
  58 + nameReq = lASEName;
  59 + }
  60 +
  61 + public int getMsgType() {
  62 + return msgType;
  63 + }
  64 +
  65 + public void setMsgType(int msgType) {
  66 + this.msgType = msgType;
  67 + }
  68 +}
... ...
src/th/co/ais/ssbsrfc/config/StateConfig.java 0 → 100644
... ... @@ -0,0 +1,592 @@
  1 +package th.co.ais.ssbsrfc.config;
  2 +
  3 +import th.co.ais.ssbsrfc.instance.CheckRequest;
  4 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  5 +import th.co.ais.ssbsrfc.utils.Log;
  6 +import ec02.af.abstracts.AbstractAF;
  7 +import ec02.af.data.EquinoxRawData;
  8 +import ec02.utils.AppLog;
  9 +
  10 +public class StateConfig {
  11 +
  12 + //define project name
  13 + public static final String PROJECT_NAME = "LBCF";
  14 + public static String PROJECT_STAT_NAME = PROJECT_NAME;
  15 + public static final boolean isMultiFlow = false;
  16 +
  17 + //define main state
  18 + public static final String STATE_IDLE = "IDLE";
  19 + public static final String STATE_ACTIVE = "ACTIVE";
  20 + public static final String STATE_E11_TIMEOUT = "E11_TIMEOUT";
  21 +
  22 + //define sub state
  23 + public static final String SSTATE_UNKNOWN = "UNKNOWN";
  24 + public static final String SSTATE_REJECT = "REJECT";
  25 + public static final String SSTATE_ABORT = "ABORT";
  26 + public static final String SSTATE_BEGIN = "BEGIN";
  27 + public static final String SSTATE_END = "END";
  28 + public static final String SSTATE_W_A = "W_A";
  29 + public static final String SSTATE_W_CHARGEREQUEST = "W_CHARGEREQUEST";
  30 + public static final String SSTATE_W_CHARGEREPORT = "W_CHARGEREPORT";
  31 + public static final String SSTATE_W_ADJUSTMENT_CHARGEREQUEST = "W_ADJUSTMENTRESPONSE_CHARGEREQUEST";
  32 + public static final String SSTATE_W_ADJUSTMENT_CHARGEREPORT = "W_ADJUSTMENTRESPONSE_CHARGEREPORT";
  33 + //define event
  34 + public static final String Incoming_Unknown ="Incoming_Unknown";
  35 + public static final String Incoming_REJECT ="Incoming_REJECT";
  36 + public static final String Incoming_ABORT ="Incoming_ABORT";
  37 + public static final String Incoming_A_Request = "Incoming_A_Request";
  38 + public static final String Incoming_ChargeRequest_Request = "Incoming_ChargeRequest_Request";
  39 + public static final String Incoming_ChargeReport_Request = "Incoming_ChargeReport_Request";
  40 + public static final String Incoming_Adjustment_ChargeRequest_Response = "Incoming_Adjustment_ChargeRequest_Response";
  41 + public static final String Incoming_Adjustment_ChargeReport_Response = "Incoming_Adjustment_ChargeReport_Response";
  42 +
  43 + //define LASE (Log, Alarm, Stat, Error)
  44 + public static final String LASE_Unknown = "Unknown Command";
  45 + public static final String LASE_Reject = "Unknown Reject";
  46 + public static final String LASE_Abort = "Unknown Abort";
  47 +
  48 + // define frist state of each flow
  49 + public static final String[] arrFirstStateFlow = {
  50 + SSTATE_W_CHARGEREQUEST,SSTATE_W_CHARGEREPORT,
  51 +
  52 + }; // SSTATE_UNKNOWN
  53 +
  54 + //define sub state list and messages that relate to
  55 +
  56 + public static State subStateList[] = {
  57 + new State(SSTATE_REJECT, Incoming_REJECT, LASE_Reject),
  58 + new State(SSTATE_ABORT, Incoming_ABORT, LASE_Abort),
  59 + new State(SSTATE_END, Incoming_Unknown, LASE_Unknown),
  60 +
  61 + new State(SSTATE_W_CHARGEREQUEST, Incoming_ChargeRequest_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),
  62 + new State(SSTATE_W_CHARGEREPORT, Incoming_ChargeReport_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),
  63 + new State(SSTATE_W_ADJUSTMENT_CHARGEREQUEST, Incoming_Adjustment_ChargeRequest_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),
  64 + new State(SSTATE_W_ADJUSTMENT_CHARGEREPORT, Incoming_Adjustment_ChargeReport_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),
  65 +// new State(SSTATE_W_A, Incoming_A_Request, "Test A", "Test A", Constant.TYPE_RESPONSE),
  66 + new State(SSTATE_END, Incoming_Unknown,"Unknown_Command"),
  67 + };
  68 +
  69 + //define event type message filter
  70 + public static final EventFilter[] eventFilter = {
  71 + // Flow 0
  72 + new EventFilter(Incoming_ChargeRequest_Request, "request", "text/plain", null, null),
  73 + new EventFilter(Incoming_ChargeReport_Request, "request", "text/plain", null, null),
  74 + new EventFilter(Incoming_Adjustment_ChargeRequest_Response, "request", "text/plain", null, null),
  75 + new EventFilter(Incoming_Adjustment_ChargeReport_Response, "request", "text/plain", null, null),
  76 + };
  77 +
  78 + public static String getSubStateFromEventType(String eventType)
  79 + {
  80 + String subState="";
  81 + try {
  82 + // find sub state to handler event type
  83 + for(int i=0; i < subStateList.length; i++)
  84 + {
  85 + State state = subStateList[i];
  86 + String ssName = state.name;
  87 + String ssEventType = state.eventType;
  88 +
  89 + // if we found matching relation
  90 + if(eventType.equals(ssEventType))
  91 + {
  92 + subState = ssName;
  93 + break;
  94 + }
  95 + }
  96 + }
  97 + catch (Exception e) {
  98 + AppLog.e("ERROR: getSubStateFromEventType!! eventType:" + eventType + "desc: " + e);
  99 + }
  100 + return subState;
  101 + }
  102 +
  103 + public static String getEventTypeFromSubState(String subState)
  104 + {
  105 + String eventType = "";
  106 + try {
  107 + // find sub state to handler event type
  108 + for(int i=0; i < subStateList.length; i++)
  109 + {
  110 + State state = subStateList[i];
  111 + String sstate = state.name;
  112 + String ssEventType = state.eventType;
  113 +
  114 + // if we found matching relation
  115 + if(sstate.equals(subState))
  116 + {
  117 + eventType = ssEventType;
  118 + break;
  119 + }
  120 + }
  121 + }
  122 + catch (Exception e) {
  123 + AppLog.e("ERROR: getEventTypeFromSubState!! subState:" + subState + "desc: " + e);
  124 + }
  125 + return eventType;
  126 + }
  127 +
  128 + public static String getCommandFromEventType(String eventType)
  129 + {
  130 + String command="";
  131 + try {
  132 + // find sub state to handler event type
  133 + for(int i=0; i < subStateList.length; i++)
  134 + {
  135 + State state = subStateList[i];
  136 + String ssCommand = state.nameReq;
  137 + String ssEventType = state.eventType;
  138 +
  139 + // if we found matching relation
  140 + if(eventType.equals(ssEventType))
  141 + {
  142 + command = ssCommand;
  143 + break;
  144 + }
  145 + }
  146 + }
  147 + catch (Exception e) {
  148 + AppLog.e("ERROR: getSubStateFromEventType!! eventType:" + eventType + "desc: " + e);
  149 + }
  150 + return command;
  151 + }
  152 +
  153 + public static void changeCommandFromEventType(String eventType, String command)
  154 + {
  155 + try {
  156 + // find sub state to handler event type
  157 + for(int i=0; i < subStateList.length; i++)
  158 + {
  159 + State state = subStateList[i];
  160 + String ssEventType = state.eventType;
  161 +
  162 + // if we found matching relation
  163 + if(eventType.equals(ssEventType))
  164 + {
  165 + subStateList[i].setLASEName(command);
  166 + break;
  167 + }
  168 + }
  169 + }
  170 + catch (Exception e) {
  171 + AppLog.e("ERROR: changeCommangFromEventType!! eventType:" + eventType + " new command:" + command + " desc: " + e);
  172 + }
  173 + }
  174 +
  175 + public static int getFlowFromEventType(String eventType)
  176 + {
  177 + int flow = -1;
  178 + try {
  179 + // find sub state to handler event type
  180 + for(int i=0; i < subStateList.length; i++)
  181 + {
  182 + State state = subStateList[i];
  183 + String ssEventType = state.eventType;
  184 + int ssFlow = state.flow;
  185 +
  186 + // if we found matching relation
  187 + if(eventType.equals(ssEventType))
  188 + {
  189 + flow = ssFlow;
  190 + break;
  191 + }
  192 + }
  193 + }
  194 + catch (Exception e) {
  195 + AppLog.e("ERROR: getFlowFromEventType!! eventType:" + eventType + "desc: " + e);
  196 + }
  197 + return flow;
  198 + }
  199 +
  200 + public static String getCommandFromState(String subState)
  201 + {
  202 + String command="";
  203 + try {
  204 + // find sub state to handler event type
  205 + for(int i=0; i < subStateList.length; i++)
  206 + {
  207 + State state = subStateList[i];
  208 + String ssCommand = state.nameReq;
  209 + String ssState = state.name;
  210 +
  211 + // if we found matching relation
  212 + if(subState.equals(ssState))
  213 + {
  214 + command = ssCommand;
  215 + break;
  216 + }
  217 + }
  218 + }
  219 + catch (Exception e) {
  220 + AppLog.e("ERROR: getSubStateFromEventType!! eventType:" + subState + "desc: " + e);
  221 + }
  222 + return command;
  223 + }
  224 +
  225 + public static String getCommandFromStateAndType(String subState, int type)
  226 + {
  227 + String command="";
  228 + try {
  229 + // find sub state to handler event type
  230 + for(int i=0; i < subStateList.length; i++)
  231 + {
  232 + State state = subStateList[i];
  233 + String ssCmdReq= state.nameReq;
  234 + String ssCmdRes= state.nameRes;
  235 + String ssState = state.name;
  236 +
  237 + // if we found matching relation
  238 + if(subState.equals(ssState))
  239 + {
  240 + if (type == Constant.TYPE_REQUEST) {
  241 + command = ssCmdReq;
  242 + } else if (type == Constant.TYPE_RESPONSE) {
  243 + command = ssCmdRes;
  244 + }
  245 + break;
  246 + }
  247 + }
  248 + }
  249 + catch (Exception e) {
  250 + AppLog.e("ERROR: getSubStateFromEventType!! eventType:" + subState + "desc: " + e);
  251 + }
  252 + return command;
  253 + }
  254 +
  255 + public static int getSubStateIndex(String currentState)
  256 + {
  257 + int idx=-1;
  258 + // find sub state to handler event type
  259 + for(int i=0; i < subStateList.length; i++)
  260 + {
  261 + State state = subStateList[i];
  262 + String ssName = state.name;
  263 +
  264 + // if we found matching relation
  265 + if(currentState.equals(ssName))
  266 + {
  267 + idx = i;
  268 + }
  269 + }
  270 + return idx;
  271 + }
  272 +
  273 + public static boolean isFirstState(String state)
  274 + {
  275 + boolean first = false;
  276 + for (String _state : arrFirstStateFlow) {
  277 + if (_state.contains(state)) {
  278 + first = true;
  279 + break;
  280 + }
  281 + }
  282 + return first;
  283 + }
  284 +
  285 + public static void setNextSubState(EC02Instance ec02Instance)
  286 + {
  287 + // get current state
  288 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  289 + String nextState = StateConfig.getNextSubState(currentState);
  290 + ec02Instance.getAFInstance().setCurrentState(nextState);
  291 + // end
  292 + }
  293 +
  294 + public static String getNextSubState(String currentState)
  295 + {
  296 + if(currentState.equals(SSTATE_END))
  297 + {
  298 + return SSTATE_END;
  299 + }
  300 +
  301 + int idx = getSubStateIndex(currentState);
  302 + if(idx != -1)
  303 + {
  304 + idx++;
  305 + State state = subStateList[idx];
  306 + String ssName = state.name;
  307 + return ssName;
  308 + }
  309 + else //if not found
  310 + {
  311 + return SSTATE_UNKNOWN;
  312 + }
  313 + }
  314 +
  315 + public static String getEventTypeFromInvoke(String invokeMsg)
  316 + {
  317 + String eventType = null;
  318 + Invoke invoke = new Invoke(invokeMsg);
  319 + eventType = invoke.getEventType();
  320 + return eventType;
  321 + }
  322 +
  323 + public static boolean isValidateEventType(String eventType)
  324 + {
  325 + boolean isValidate = false;
  326 +
  327 + // find sub state to handler event type
  328 + for(int i=0; i < subStateList.length; i++)
  329 + {
  330 + State state = subStateList[i];
  331 + String ssEventType = state.eventType;
  332 +
  333 + // if we found matching relation
  334 + if(ssEventType.equals(eventType))
  335 + {
  336 + isValidate = true;
  337 + }
  338 + }
  339 + return isValidate;
  340 + }
  341 +
  342 + public static String getEventTypeFromEquinoxRawData(EC02Instance ec02Instance, EquinoxRawData rawData)
  343 + {
  344 + String eventType = null;
  345 + // 1.1.1. Extract type, ctype, method, invoke, ret attributes.
  346 + String type = rawData.getRawDataAttribute("type");
  347 + String ctype = rawData.getRawDataAttribute("ctype");
  348 + String method = rawData.getRawDataAttribute("method");
  349 + String invoke = rawData.getInvoke();
  350 + String cmd = "";
  351 + /*String ret = rawData.getRawDataAttribute("ret");
  352 + // 1.1.2. If ret in (1, 2, 3, 4) Then
  353 + if (ret.equals("2")) {
  354 + return StateConfig.Incoming_REJECT;
  355 + } else if (ret.equals("3")) {
  356 + return StateConfig.Incoming_ABORT;
  357 + }*/
  358 +// if (type.equals("response")) {
  359 +// ArrayList<Timeout> listTimeout = ec02Instance.getAFInstance().getListTimeout();
  360 +// boolean isBool = false;
  361 +// for (Timeout timeout : listTimeout) {
  362 +// if (timeout.getName().equals(invoke)) {
  363 +// isBool = true;
  364 +// }
  365 +// }
  366 +// if (!isBool) {
  367 +// return StateConfig.Incoming_Unknown;
  368 +// }
  369 +// }
  370 +
  371 + // 1.1.3. Try to get event type from invoke
  372 + if(invoke != null && invoke.length() >0)
  373 + {
  374 + // 1.1.4. If valid event type Then
  375 + String event = getEventTypeFromInvoke(invoke);
  376 + if(event != null && isValidateEventType(event))
  377 + {
  378 + // 1.1.4.1. Set event type = <valid event type>
  379 + return event;
  380 + }
  381 + }
  382 +
  383 + // 1.1.6. Get event type from type, ctype, method, cmd
  384 + int maxCount = 0;
  385 + for(int i=0; i < eventFilter.length; i++)
  386 + {
  387 + EventFilter ef = eventFilter[i];
  388 + boolean bMatch = false;
  389 + int count = 0; //use for count matched in each parameter
  390 +
  391 + // try matching 1 by 1
  392 + // check type
  393 + if(ef.type != null)
  394 + {
  395 + if(type.equals(ef.type))
  396 + {
  397 + bMatch = true;
  398 + count++;
  399 + }
  400 + else
  401 + bMatch = false;
  402 + }
  403 +
  404 + // check ctype
  405 + if(ef.ctype != null)
  406 + {
  407 + if(ctype.equals(ef.ctype))
  408 + {
  409 + bMatch = true;
  410 + count++;
  411 + }
  412 + else
  413 + bMatch = false;
  414 + }
  415 +
  416 + // check method
  417 + if(ef.method != null)
  418 + {
  419 + if(method.equals(ef.method))
  420 + {
  421 + bMatch = true;
  422 + count++;
  423 + }
  424 + else
  425 + bMatch = false;
  426 + }
  427 +
  428 + // check cmd
  429 + if(ef.cmd != null)
  430 + {
  431 + if(cmd.equals(ef.cmd))
  432 + {
  433 + bMatch = true;
  434 + count++;
  435 + }
  436 + else
  437 + bMatch = false;
  438 + }
  439 + //check and set maxCount for use to select event type
  440 + if(bMatch && count > maxCount)
  441 + {
  442 + maxCount = count;
  443 +
  444 + //set return event type to this matched
  445 + eventType = ef.eventType;
  446 + }
  447 + AppLog.d("EVENT TYPE:"+eventType+"In If"+eventType.equals(StateConfig.Incoming_A_Request));
  448 + if (eventType.equals(StateConfig.Incoming_ChargeRequest_Request)) {
  449 + //String page = rawData.getRawDataMessage();
  450 + String page = rawData.getRawDataAttribute("val");
  451 + CheckRequest checkRequest = new CheckRequest();
  452 + checkRequest.setDn(page);
  453 + String [] dnList = checkRequest.getDn().split("&", -1);
  454 + page = dnList[0].substring("page=".length());
  455 + if (page.equals("chargeRequest")) {
  456 + eventType = StateConfig.Incoming_ChargeRequest_Request;
  457 + } else if (page.equals("chargeReport")) {
  458 + eventType = StateConfig.Incoming_ChargeReport_Request;
  459 + }
  460 + }
  461 + }
  462 + return eventType;
  463 + }
  464 +
  465 + public static String getLASEName(String currentSubState, int sendOrReceive, int responseOrRequest, int missingOrInvalidOrTARE, String errMsg)
  466 + {
  467 + String name = StateConfig.getLASEName(currentSubState, sendOrReceive, responseOrRequest, missingOrInvalidOrTARE, errMsg, null);
  468 + return name;
  469 + }
  470 +
  471 + public static String getLASEName(String currentSubState, int sendOrReceive, int responseOrRequest, int missingOrInvalidOrTARE, String errMsg, String command, int flow)
  472 + {
  473 + switch (flow) {
  474 + default:
  475 + StateConfig.PROJECT_STAT_NAME = StateConfig.PROJECT_NAME;
  476 + break;
  477 + }
  478 +
  479 + String name = StateConfig.getLASEName(currentSubState, sendOrReceive, responseOrRequest, missingOrInvalidOrTARE, errMsg, command);
  480 + return name;
  481 + }
  482 +
  483 + public static String getLASEName(String currentSubState, int sendOrReceive, int responseOrRequest, int missingOrInvalidOrTARE, String errMsg, String command)
  484 + {
  485 +// AppLog.d("## [mSSB-SRFC] [Send|Received] [Bad] <CommandName> [Response|Request] [Timeout|Abort|Reject|Error] [errMsg]");
  486 +// AppLog.d("## getLASEName :" + currentSubState + "/" + sendOrReceive + "/" + responseOrRequest + "/" + missingOrInvalidOrTARE + "/" + errMsg);
  487 + String stateName = null;
  488 +// int idx = StateConfig.getSubStateIndex(currentSubState);
  489 +// State state = StateConfig.subStateList[idx];
  490 + String LASEName = StateConfig.getCommandFromStateAndType(currentSubState, responseOrRequest);
  491 +
  492 + /*
  493 + * [mSSB-SRFC] [Send|Received] [Bad] <CommandName> [Response|Request] [Timeout|Abort|Reject|Error]
  494 + */
  495 +
  496 + String sr = "";
  497 +
  498 + switch (sendOrReceive)
  499 + {
  500 + case Constant.TYPE_SEND:
  501 + sr = Constant.SEND;
  502 + break;
  503 + case Constant.TYPE_RECEIVE:
  504 + sr = Constant.RECEIVE;
  505 + break;
  506 + }
  507 +
  508 + String rr = "";
  509 + switch (responseOrRequest)
  510 + {
  511 + case Constant.TYPE_RESPONSE:
  512 + rr = Constant.RESPONSE + " ";
  513 + break;
  514 + case Constant.TYPE_REQUEST:
  515 + rr = Constant.REQUEST + " ";
  516 + break;
  517 + }
  518 +
  519 + //Timeout, Abort, Reject, Error
  520 + String tare = "";
  521 + String bad = "";
  522 + String cmd = "";
  523 + switch (missingOrInvalidOrTARE)
  524 + {
  525 + case Constant.TYPE_MISSING:
  526 + bad = Constant.BAD + " ";
  527 + break;
  528 + case Constant.TYPE_INVALID:
  529 + bad = Constant.BAD + " ";
  530 + break;
  531 + case Constant.TYPE_DUPLICATE:
  532 + bad = Constant.DUPLICATE + " ";
  533 + break;
  534 + case Constant.TYPE_TIMEOUT:
  535 + tare = Constant.TIMEOUT;
  536 + break;
  537 + case Constant.TYPE_ABORT:
  538 + tare = Constant.ABORT;
  539 + break;
  540 + case Constant.TYPE_REJECT:
  541 + tare = Constant.REJECT;
  542 + break;
  543 + case Constant.TYPE_ERROR:
  544 + case Constant.TYPE_UNKNOWN_ERROR:
  545 + tare = Constant.ERROR;
  546 + break;
  547 + }
  548 +
  549 + if (command != null) {
  550 + cmd = command;
  551 + } else {
  552 + if (missingOrInvalidOrTARE == Constant.TYPE_REJECT_APPLICATION) {
  553 + cmd = "Unknown";
  554 + rr = Constant.REQUEST + " ";
  555 + } else {
  556 + cmd = LASEName;
  557 + }
  558 + }
  559 +
  560 + stateName = StateConfig.PROJECT_STAT_NAME + " " + sr + " " + bad + cmd + " " + rr + tare;
  561 + stateName = stateName.trim();
  562 +
  563 + return stateName;
  564 + }
  565 +
  566 + public static String getTimeout(AbstractAF abstractAF, String event) {
  567 + String timeout = StateConfig.getTimeout(abstractAF, event, null);
  568 + return timeout;
  569 + }
  570 +
  571 + public static String getTimeout(AbstractAF abstractAF, String event, String command) {
  572 + String time = "10";
  573 + String configName = "Default-timeout";
  574 + try {
  575 + if (event.equals(StateConfig.Incoming_Unknown)) {
  576 + configName = "Wait-Get-File-Timeout";
  577 + } else {
  578 + configName = "Default-timeout";
  579 + }
  580 +
  581 + time = abstractAF.getUtils().getHmWarmConfig().get(configName).get(0);
  582 + AppLog.d("## SET TIMEOUT: " + configName + " " + time + " sec");
  583 + } catch (Exception e) {
  584 + if (Log.debug) {
  585 + AppLog.d("## CHECKCONFIG EC02 READDING...");
  586 + AppLog.d("## EXCEPTION : " + e.getMessage());
  587 + AppLog.d("## DATA EVENTTYPE OR INVOKE:" + event + " COMMAND:" + command);
  588 + }
  589 + }
  590 + return time;
  591 + }
  592 +}
... ...
src/th/co/ais/ssbsrfc/control/FlowManager.java 0 → 100644
... ... @@ -0,0 +1,470 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Iterator;
  5 +import java.util.LinkedHashMap;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import org.apache.commons.lang.ArrayUtils;
  10 +
  11 +import th.co.ais.ssbsrfc.config.Constant;
  12 +import th.co.ais.ssbsrfc.config.StateConfig;
  13 +import th.co.ais.ssbsrfc.instance.AFInstance;
  14 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  15 +import th.co.ais.ssbsrfc.instance.FMInstance;
  16 +import th.co.ais.ssbsrfc.instance.ManageTime;
  17 +import th.co.ais.ssbsrfc.instance.Timeout;
  18 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  19 +import th.co.ais.ssbsrfc.message.MessageParser;
  20 +import th.co.ais.ssbsrfc.utils.Global;
  21 +import th.co.ais.ssbsrfc.utils.Log;
  22 +import ec02.af.abstracts.AbstractAF;
  23 +import ec02.af.data.EquinoxRawData;
  24 +import ec02.utils.AppLog;
  25 +
  26 +public class FlowManager {
  27 + private AbstractAF abstractAF = null;
  28 + private EC02Instance ec02Instance = null;
  29 + private AFInstance afInstance = null;
  30 + private EquinoxRawData equinoxRawData = null;
  31 + private int flow = 0;
  32 + private String type = EQXMsg.EMPTY;
  33 +// private int[] arrSingleFlow = {Constant.FLOW_Loan_Potential_Jobs_Tracking, Constant.FLOW_Loan_Potential_Registration, Constant.FLOW_Loan_Potential_Request_Handling, Constant.FLOW_Loan_UI, Constant.FLOW_Loan_Activation, Constant.FLOW_Loan_Customer_Registration};
  34 + private FMInstance ins = null;
  35 + private ArrayList<FMInstance> listFlow = new ArrayList<FMInstance>();
  36 + private Map<String, FMInstance> dicInvoke = new LinkedHashMap<String, FMInstance>();
  37 + private ArrayList<Timeout> listTimeout = new ArrayList<Timeout>();
  38 + private ArrayList<Timeout> globalListTimeout = new ArrayList<Timeout>();
  39 + private int globalDialogueId = -1;
  40 + private boolean debug = false;
  41 +
  42 + public FlowManager(AbstractAF abstractAF, EC02Instance ec02Instance) {
  43 + super();
  44 + this.abstractAF = abstractAF;
  45 + this.ec02Instance = ec02Instance;
  46 + this.afInstance = ec02Instance.getAFInstance();
  47 + }
  48 + public void start(EquinoxRawData equinoxRawData)
  49 + {
  50 + this.equinoxRawData = equinoxRawData;
  51 + this.listFlow = this.afInstance.getListFlow();
  52 + this.dicInvoke = this.afInstance.getDicInvoke();
  53 + this.globalDialogueId = this.afInstance.getGlobalDialogueId();
  54 + this.listTimeout = this.afInstance.getListTimeout();
  55 + this.globalListTimeout = this.afInstance.getGlobalListTimeout();
  56 +
  57 + if (this.debug) {
  58 + AppLog.d("####### TABLE LISTFLOW #######");
  59 + AppLog.d("## SIZE:" + this.ec02Instance.getAFInstance().getListFlow().size());
  60 + AppLog.d("## INPUT TIMESTAMP:" + this.ec02Instance.getAFInstance().getStartFlowTimeStamp());
  61 + AppLog.d("------------------------------");
  62 + for (FMInstance i : this.ec02Instance.getAFInstance().getListFlow()) {
  63 + AppLog.d(i.toString());
  64 + }
  65 + AppLog.d("############# END ############");
  66 + }
  67 + if (this.listFlow.size() != 0) {
  68 +// try {
  69 + // case e01
  70 + if (this.abstractAF.getUtils().getGlobalData().isRecieve()) {
  71 + String invoke = equinoxRawData.getInvoke();
  72 + this.setInstanceForInvoke(invoke);
  73 + if (this.debug) {
  74 + AppLog.d("## CASE EO1 GET INVOKE:" + invoke);
  75 + }
  76 + }
  77 + else {
  78 + String ret = equinoxRawData.getRet();
  79 + if (ret.equals("4")) { // Timeout
  80 + String unique = equinoxRawData.getRawDataAttribute("unique");
  81 + this.setInstanceForUnique(unique);
  82 + if (this.debug) {
  83 + AppLog.d("## CASE TIMEOUT GET UNIQUE:" + unique);
  84 + }
  85 + } else {
  86 + String type = equinoxRawData.getType();
  87 + if ((type.toLowerCase().equals("request") || type.toLowerCase().equals("noreply")) && !ret.equals("1") && !ret.equals("2") && !ret.equals("3")) {
  88 + String eventType = equinoxRawData.getRawEventType();
  89 + String ssName = StateConfig.getSubStateFromEventType(eventType);
  90 + int flow = StateConfig.getFlowFromEventType(eventType);
  91 +// if (flow == -1 && type.toLowerCase().equals("noreply")) {
  92 +// String invoke = equinoxRawData.getInvoke();
  93 +// if (invoke != null && invoke.contains(".")) {
  94 +// Object code = new Invoke(invoke).dev;
  95 +// String strCode = (String)code;
  96 +// if (strCode != null && strCode.equals("16")) {
  97 +// flow = Constant.FLOW_Loan_Potential_Request_Handling;
  98 +// }
  99 +// }
  100 +// }
  101 + if (this.debug) {
  102 + AppLog.d("## CASE REQUEST MESSAGE GET FLOW:" + flow);
  103 + AppLog.d("## EVENTTYPE:" + eventType);
  104 + AppLog.d("## SUBSTATE FOR EVENTTYPE:" + ssName);
  105 + }
  106 + if (flow != -1) {
  107 + this.flow = flow;
  108 + String firstState = StateConfig.arrFirstStateFlow[flow-1];
  109 + if (this.debug) {
  110 + AppLog.d("## FLOW:" + this.flow);
  111 + AppLog.d("## FIRST STATE:" + firstState);
  112 + }
  113 + if (ssName.equals(firstState) && !ArrayUtils.contains(Constant.arrSingleFlow, this.flow)) {
  114 + this.setInstance(new AFInstance());
  115 + if (this.debug) {
  116 + AppLog.d("## CASE START STATE FOR MULTI FLOW::NEW INSTANCE");
  117 + }
  118 + } else if (/*ssName.equals(firstState) && */ArrayUtils.contains(Constant.arrSingleFlow, this.flow)) {
  119 + this.setInstanceForFlow(flow);
  120 + if (this.debug) {
  121 + AppLog.d("## CASE SINGLE FLOW::GET INSTANCE FOR FLOW:" + this.flow);
  122 + }
  123 + } else { // not first state
  124 + this.setInstanceForFlow(flow);
  125 + if (this.debug) {
  126 + AppLog.d("## CASE NOT FIRST STATE::GET INSTANCE FOR FLOW:" + this.flow);
  127 + }
  128 + }
  129 + } else { //
  130 +// if (eventType.equals(StateConfig.Incoming_DRR_Request) || eventType.equals(StateConfig.Incoming_DUR_Request)) {
  131 +// String key = "Dialogue-Id";
  132 +// String dialogueId = this.equinoxRawData.getRawDataAttribute(key);
  133 +// this.equinoxRawData.getRawDataAttributes().remove(key);
  134 +// // SET FLOW from Dialogue-Id
  135 +// this.setInstanceForDialogueId(dialogueId);
  136 +// if (this.debug) {
  137 +// AppLog.d("## CASE DRR/DUR REQUEST::GET INSTANCE FOR DIALOGUE_ID:" + dialogueId);
  138 +// }
  139 +// } else { // impossible.
  140 + int index = this.listFlow.size() - 1;
  141 + FMInstance ins = this.listFlow.get(index);
  142 + this.listFlow.remove(index);
  143 + AFInstance data = (AFInstance) MessageParser.fromJson(ins.getData(), AFInstance.class);
  144 + this.setInstance(data);
  145 + if (this.debug) {
  146 + AppLog.d("## CASE IMPOSSIBLE::GET INSTANCE FOR INDEX:" + index);
  147 + }
  148 +// }
  149 + }
  150 +// } else if (type.toLowerCase().equals("response") && (ret.equals("1") || ret.equals("2") || ret.equals("3"))) {
  151 +// int index = this.listFlow.size() - 1;
  152 +// FMInstance ins = this.listFlow.get(index);
  153 +// this.listFlow.remove(index);
  154 +// AFInstance data = (AFInstance) MessageParser.fromJson(ins.getData(), AFInstance.class);
  155 +// this.setInstance(data);
  156 +// if (this.debug) {
  157 +// AppLog.d("## CASE IMPOSSIBLE::GET INSTANCE FOR INDEX:" + index);
  158 +// }
  159 + } else {
  160 + String invoke = equinoxRawData.getInvoke();
  161 + this.setInstanceForInvoke(invoke);
  162 + if (this.debug) {
  163 + AppLog.d("## CASE RESPONE MESSAGE::GET INSTANCE FOR INVOKE:" + invoke);
  164 + }
  165 + }
  166 + }
  167 + }
  168 +// } catch (Exception e) {
  169 +// if (this.debug) {
  170 +// AppLog.d("## EXCEPTION(GET START MULTI FLOW):" + e);
  171 +// }
  172 +// int index = this.listFlow.size() - 1;
  173 +// FMInstance ins = this.listFlow.get(index);
  174 +// this.listFlow.remove(index);
  175 +// AFInstance data = (AFInstance) MessageParser.fromJson(ins.getData(), AFInstance.class);
  176 +// this.setInstance(data);
  177 +// }
  178 + } else {
  179 + if (this.debug) {
  180 + AppLog.d("## FLOWMANAGER START");
  181 + AppLog.d("## 1.START FLOW TIMESTAMP:" + this.ec02Instance.getAFInstance().getStartFlowTimeStamp());
  182 + AppLog.d("## 2.INPUT TIMESTAMP:" + Global.inputTimeStamp);
  183 + AppLog.d("## 3.CURRENT START:" + this.ec02Instance.getAFInstance().getCurrentState());
  184 + }
  185 + }
  186 + if (this.debug) {
  187 + AppLog.d("## GET INSTANCE START FLOW TIMESTAMP:" + this.ec02Instance.getAFInstance().getStartFlowTimeStamp());
  188 + }
  189 + }
  190 + public void end(String curState, String nxtState, List<EquinoxRawData> eqxRawDataListInput, List<EquinoxRawData> eqxRawDataListOutput)
  191 + {
  192 + Log.detailLog(this.ec02Instance, this.abstractAF, curState, nxtState, eqxRawDataListInput, eqxRawDataListOutput);
  193 + Log.summaryLog(this.ec02Instance, this.abstractAF);
  194 + this.listFlow = this.ec02Instance.getAFInstance().getListFlow();
  195 + this.dicInvoke = this.ec02Instance.getAFInstance().getDicInvoke();
  196 + this.globalDialogueId = this.ec02Instance.getAFInstance().getGlobalDialogueId();
  197 + this.globalListTimeout = this.ec02Instance.getAFInstance().getGlobalListTimeout();
  198 + // clear
  199 + this.ec02Instance.getAFInstance().setListFlow(null);
  200 + this.ec02Instance.getAFInstance().setDicInvoke(null);
  201 + this.ec02Instance.getAFInstance().setGlobalListTimeout(null);
  202 + if (!nxtState.equals(StateConfig.STATE_IDLE)) {
  203 +// Gson gsonBuilder = new GsonBuilder().create();
  204 + AFInstance af = this.ec02Instance.getAFInstance();
  205 + String data = Global.encodeInstance(af);
  206 + int flow = af.getFlow();
  207 + String date = af.getStartFlowTimeStamp();
  208 + String dialogueId = af.getDialogueIdForMultiFlow();
  209 + String unique = Global.getUnique();
  210 + FMInstance newIns = new FMInstance(flow, date, data, dialogueId);
  211 + newIns.setUnique(unique);
  212 + if (this.debug) {
  213 + AppLog.d("## FLOWMANAGER END");
  214 + AppLog.d("## FLOW:" + flow);
  215 + AppLog.d("## DATE:" + date);
  216 + AppLog.d("## DIALOGUE_ID:" + dialogueId);
  217 + AppLog.d("## UNIQUE:" + unique);
  218 + }
  219 + ManageTime mTimeout = new ManageTime(this.ec02Instance);
  220 + Timeout ins = mTimeout.getInsTime();
  221 + if (ins != null) {
  222 + ManageTime mt = new ManageTime();
  223 + mt.setListTimeout(this.ec02Instance.getAFInstance().getGlobalListTimeout());
  224 + mt.setTimeout(newIns.getUnique(), "" + ins.getTimeout(), ins.getDate());
  225 + this.ec02Instance.getAFInstance().setGlobalListTimeout(mt.getListTimeout());
  226 + }
  227 +// this.ec02Instance.getAFInstance().putListFlow(newIns);
  228 + this.listFlow = this.listFlow == null ? new ArrayList<FMInstance>() : this.listFlow;
  229 + this.listFlow.add(newIns);
  230 + if (this.debug) {
  231 + AppLog.d("## LIST FLOW COUNT:" + this.listFlow.size());
  232 + }
  233 + }
  234 +// this.ec02Instance.getAFInstance().setStartFlowTimeStamp("");
  235 + if (this.debug) {
  236 + AppLog.d("####### TABLE LISTFLOW #######");
  237 + AppLog.d("## SIZE:" + this.listFlow.size());
  238 + AppLog.d("------------------------------");
  239 + for (FMInstance i : this.listFlow) {
  240 + AppLog.d(i.toString());
  241 + }
  242 + AppLog.d("############# END ############");
  243 + AppLog.d("####### TABLE DIC INVOKE #######");
  244 + AppLog.d("## SIZE:" + this.dicInvoke.size());
  245 + AppLog.d("------------------------------");
  246 + if (this.dicInvoke != null) {
  247 + Iterator<?> it = this.ec02Instance.getAFInstance().getDicInvoke().entrySet().iterator();
  248 + while (it.hasNext()) {
  249 + @SuppressWarnings("rawtypes")
  250 + Map.Entry pair = (Map.Entry)it.next();
  251 + AppLog.d(pair.getKey()+ ":" + pair.getValue().toString());
  252 + }
  253 + }
  254 + AppLog.d("############# END ############");
  255 + }
  256 +
  257 + this.setInstance(new AFInstance());
  258 + }
  259 +
  260 + public FMInstance find(FMInstance ins)
  261 + {
  262 + if (this.debug) {
  263 + AppLog.d("####### TABLE LISTFLOW #######");
  264 + AppLog.d("## SIZE:" + this.listFlow.size());
  265 + AppLog.d("------------------------------");
  266 + for (FMInstance i : this.listFlow) {
  267 + AppLog.d(i.toString());
  268 + }
  269 + AppLog.d("############# END ############");
  270 + AppLog.d("FMInstance find:" + ins.toString());
  271 + }
  272 +
  273 + FMInstance newIns = null;
  274 + for (FMInstance i : this.listFlow) {
  275 + if (ins.getUnique() != null && i.getUnique().equals(ins.getUnique())) {
  276 +// AppLog.d("## unique");
  277 +// AppLog.d("unique:" + ins.getUnique());
  278 + newIns = i;
  279 + break;
  280 + } else if (ins.getDialogueId() != null) {
  281 +// AppLog.d("## dialogueId");
  282 + if (i.getDialogueId().equals(ins.getDialogueId())) {
  283 +// AppLog.d("getDialogueId:" + ins.getDialogueId());
  284 + newIns = i;
  285 + break;
  286 + }
  287 + } else if (ins.getDate() != null) {
  288 +// AppLog.d("## date");
  289 + if (i.getFlow() == ins.getFlow() && i.getDate().equals(ins.getDate())) {
  290 +// AppLog.d("flow:" + i.getFlow() + " date:" + i.getDate());
  291 + newIns = i;
  292 + break;
  293 + }
  294 + } else {
  295 +// AppLog.d("## flow");
  296 + if (i.getFlow() == ins.getFlow()) {
  297 +// AppLog.d("flow:" + i.getFlow() );
  298 + newIns = i;
  299 + break;
  300 + }
  301 + }
  302 + }
  303 + // remove
  304 + if (newIns != null) {
  305 + this.listFlow.remove(newIns);
  306 + if (this.debug) {
  307 + AppLog.d("## REMOVE:" +newIns.getFlow() + " " + newIns.getDate() + " " + newIns.getUnique());
  308 + AppLog.d("## globalListTimeout:" + this.globalListTimeout.size());
  309 + }
  310 + // remove globalListTimeout
  311 + try {
  312 + Timeout mIns = null;
  313 + for (Timeout mt : this.globalListTimeout) {
  314 + if (newIns.getUnique() != null && mt.getName() != null && mt.getName().equals(newIns.getUnique())){
  315 + mIns = mt;
  316 + break;
  317 + }
  318 + }
  319 + // check remove
  320 + if (mIns != null) {
  321 + this.globalListTimeout.remove(mIns);
  322 + }
  323 + if (this.debug) {
  324 + AppLog.d("## REMOVE GLOBAL_LIST_TIMEOUT COUNT:" + this.globalListTimeout.size());
  325 + }
  326 + } catch (Exception e) {
  327 + if (this.debug) {
  328 + AppLog.e("## Exception(remove globalListTimeout:" + this.globalListTimeout.size() + "):" + e.getMessage());
  329 + }
  330 + }
  331 + }
  332 + return newIns;
  333 + }
  334 + public void setInstance(AFInstance ins)
  335 + {
  336 + ins.setListFlow(this.listFlow);
  337 + ins.setDicInvoke(this.dicInvoke);
  338 + ins.setGlobalDialogueId(this.globalDialogueId);
  339 + ins.setGlobalListTimeout(this.globalListTimeout);
  340 + if (ins.getStartFlowTimeStamp() == null && this.ec02Instance.getAFInstance().getStartFlowTimeStamp() != null) {
  341 + ins.setStartFlowTimeStamp(this.ec02Instance.getAFInstance().getStartFlowTimeStamp());
  342 + }
  343 + // set instance
  344 + this.ec02Instance.setAFInstance(ins);
  345 + if (this.debug) {
  346 + AppLog.d("## FUNCTION SET INSTANCE");
  347 + AppLog.d("## 1.START FLOW TIMESTAMP:" + ins.getStartFlowTimeStamp());
  348 + AppLog.d("## 2.INPUT TIMESTAMP:" + this.ec02Instance.getAFInstance().getStartFlowTimeStamp());
  349 + }
  350 + }
  351 + public void setInstanceForInvoke(String invoke)
  352 + {
  353 +// AppLog.d("#d# invoke :" + invoke);
  354 + FMInstance ins = this.dicInvoke.get(invoke);
  355 +// AppLog.d("setInstanceForInvoke:" + ins.getFlow() + " " + ins.getDate());
  356 + this.dicInvoke.remove(invoke);
  357 + this.setInstance(ins);
  358 + }
  359 + public void setInstanceForFlow(int flow)
  360 + {
  361 + FMInstance ins = new FMInstance(flow);
  362 +// AppLog.d(ins.toString());
  363 + this.setInstance(ins);
  364 + }
  365 + public void setInstanceForDialogueId(String dialogueId)
  366 + {
  367 + FMInstance ins = new FMInstance(flow, null, null, dialogueId);
  368 + this.setInstance(ins);
  369 +
  370 + }
  371 + public void setInstanceForUnique(String unique)
  372 + {
  373 + FMInstance ins = new FMInstance();
  374 + ins.setUnique(unique);
  375 + ArrayList<Timeout> listTimeout = this.ec02Instance.getAFInstance().getListTimeout();
  376 + for (Timeout timeout : listTimeout) {
  377 + this.dicInvoke.remove(timeout.getName());
  378 + }
  379 + this.setInstance(ins);
  380 + }
  381 + public void setInstance(FMInstance ins)
  382 + {
  383 + if (this.debug) {
  384 + AppLog.d("## FIND AF_INSTANCE");
  385 + AppLog.d(ins.toString());
  386 + }
  387 + try {
  388 + ins = this.find(ins);
  389 + if (ins == null) {
  390 + this.setInstance(new AFInstance());
  391 + if (this.debug) {
  392 + AppLog.d("## NOSUCH OBJECT::NEW AF_INSTANCE");
  393 + }
  394 + } else {
  395 +// AFInstance data = (AFInstance) MessageParser.fromJson(ins.getData(), AFInstance.class);
  396 + AFInstance data = Global.decodeInstance(ins.getData());
  397 + this.setInstance(data);
  398 + if (this.debug) {
  399 + AppLog.d("## OBJECT DATA");
  400 + AppLog.d("## 1.FLOW:" + data.getFlow());
  401 + AppLog.d("## 2.START FLOW TIMESTAMP:" + data.getStartFlowTimeStamp());
  402 + }
  403 + }
  404 + } catch (Exception e) {
  405 + if (this.debug) {
  406 + AppLog.e("## EXCEPTION:" + e.getMessage());
  407 + }
  408 + }
  409 + }
  410 + public AbstractAF getAbstractAF() {
  411 + return abstractAF;
  412 + }
  413 + public void setAbstractAF(AbstractAF abstractAF) {
  414 + this.abstractAF = abstractAF;
  415 + }
  416 + public EC02Instance getEc02Instance() {
  417 + return ec02Instance;
  418 + }
  419 + public void setEc02Instance(EC02Instance ec02Instance) {
  420 + this.ec02Instance = ec02Instance;
  421 + }
  422 + public int getFlow() {
  423 + return flow;
  424 + }
  425 + public void setFlow(int flow) {
  426 + this.flow = flow;
  427 + }
  428 + public String getType() {
  429 + return type;
  430 + }
  431 + public void setType(String type) {
  432 + this.type = type;
  433 + }
  434 + public FMInstance getIns() {
  435 + return ins;
  436 + }
  437 + public void setIns(FMInstance ins) {
  438 + this.ins = ins;
  439 + }
  440 + public ArrayList<FMInstance> getListFlow() {
  441 + return listFlow;
  442 + }
  443 + public void setListFlow(ArrayList<FMInstance> listFlow) {
  444 + this.listFlow = listFlow;
  445 + }
  446 + public Map<String, FMInstance> getDicInvoke() {
  447 + return dicInvoke;
  448 + }
  449 + public void setDicInvoke(Map<String, FMInstance> dicInvoke) {
  450 + this.dicInvoke = dicInvoke;
  451 + }
  452 + public AFInstance getAfInstance() {
  453 + return afInstance;
  454 + }
  455 + public void setAfInstance(AFInstance afInstance) {
  456 + this.afInstance = afInstance;
  457 + }
  458 + public ArrayList<Timeout> getListTimeout() {
  459 + return listTimeout;
  460 + }
  461 + public void setListTimeout(ArrayList<Timeout> listTimeout) {
  462 + this.listTimeout = listTimeout;
  463 + }
  464 + public EquinoxRawData getEquinoxRawData() {
  465 + return equinoxRawData;
  466 + }
  467 + public void setEquinoxRawData(EquinoxRawData equinoxRawData) {
  468 + this.equinoxRawData = equinoxRawData;
  469 + }
  470 +}
... ...
src/th/co/ais/ssbsrfc/control/StateManager.java 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import th.co.ais.ssbsrfc.config.StateConfig;
  4 +import th.co.ais.ssbsrfc.state.StateIdle;
  5 +import th.co.ais.ssbsrfc.state.StateWaitActive;
  6 +import th.co.ais.ssbsrfc.state.StateWaitE11Timeout;
  7 +import ec02.af.abstracts.AbstractAFStateManager;
  8 +
  9 +public class StateManager extends AbstractAFStateManager {
  10 + public StateManager(String state) {
  11 + this.afState = null;
  12 + if (state.equals(StateConfig.STATE_IDLE)) {
  13 + this.afState = new StateIdle();
  14 + } else if (state.equals(StateConfig.STATE_ACTIVE)) {
  15 + this.afState = new StateWaitActive();
  16 + } else if (state.equals(StateConfig.STATE_E11_TIMEOUT)) {
  17 + this.afState = new StateWaitE11Timeout();
  18 + }
  19 + }
  20 +}
... ...
src/th/co/ais/ssbsrfc/control/SubStateManager.java 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import th.co.ais.ssbsrfc.config.StateConfig;
  4 +import th.co.ais.ssbsrfc.interfaces.AbstractAFSubStateManager;
  5 +import th.co.ais.ssbsrfc.substate.SubWaitA;
  6 +import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeReportResponse;
  7 +import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeRequestResponse;
  8 +import th.co.ais.ssbsrfc.substate.SubWaitChargeReport;
  9 +import th.co.ais.ssbsrfc.substate.SubWaitChargeRequest;
  10 +import ec02.utils.Log;
  11 +
  12 +public class SubStateManager extends AbstractAFSubStateManager {
  13 +
  14 + public SubStateManager(String subState) {
  15 + Log.i("[Sub State ] : " + subState);
  16 + this.subStateManager = null;
  17 +
  18 + if (subState.equals(StateConfig.SSTATE_W_CHARGEREQUEST)) {
  19 + this.subStateManager = new SubWaitChargeRequest();
  20 + }
  21 + else if (subState.equals(StateConfig.SSTATE_W_CHARGEREPORT)) {
  22 + this.subStateManager = new SubWaitChargeReport();
  23 + }
  24 + else if (subState.equals(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT)) {
  25 + this.subStateManager = new SubWaitAdjustmentChargeReportResponse();
  26 + }
  27 + else if (subState.equals(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST)) {
  28 + this.subStateManager = new SubWaitAdjustmentChargeRequestResponse();
  29 + }
  30 + }
  31 +}
... ...
src/th/co/ais/ssbsrfc/control/TestDebugMsg.java 0 → 100644
... ... @@ -0,0 +1,106 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import java.io.BufferedReader;
  4 +import java.io.ByteArrayInputStream;
  5 +import java.io.ByteArrayOutputStream;
  6 +import java.io.FileReader;
  7 +import java.io.IOException;
  8 +
  9 +import javax.xml.parsers.ParserConfigurationException;
  10 +import javax.xml.transform.OutputKeys;
  11 +import javax.xml.transform.Source;
  12 +import javax.xml.transform.Transformer;
  13 +import javax.xml.transform.TransformerException;
  14 +import javax.xml.transform.TransformerFactory;
  15 +import javax.xml.transform.sax.SAXSource;
  16 +import javax.xml.transform.stream.StreamResult;
  17 +import javax.xml.xpath.XPathExpressionException;
  18 +
  19 +import org.xml.sax.InputSource;
  20 +import org.xml.sax.SAXException;
  21 +
  22 +import ec02.exception.MessageParserException;
  23 +import ec02.server.EC02Handler;
  24 +import ec02.server.EC02Server;
  25 +
  26 +public class TestDebugMsg {
  27 + public static void main(String[] args) throws IOException,
  28 + TransformerException, XPathExpressionException,
  29 + ParserConfigurationException, SAXException, MessageParserException {
  30 +
  31 + BufferedReader in = new BufferedReader(new FileReader(
  32 + "./example.msg/" +
  33 +// "debug.html-text-plain.xml"
  34 +// "debug.html-text-xml.xml"
  35 +// "debug.html-text-xml-header.xml"
  36 +// "debug.ldap.xml"
  37 +// "debug.diameter.xml"
  38 + "debug.xml"
  39 + ));
  40 +
  41 + String str, reqMessage = "";
  42 + String conf = "";
  43 + String temp = "";
  44 + while ((str = in.readLine()) != null) {
  45 + reqMessage += str;
  46 + }
  47 + in.close();
  48 + in = new BufferedReader(new FileReader("./conf/WS1.EC02.SERV.0"));
  49 + while ((temp = in.readLine()) != null) {
  50 + conf += temp;
  51 + }
  52 + in.close();
  53 + String[] a = { "WS1", "SERV", "0", conf };
  54 +
  55 + EC02Server.main(a);
  56 + EC02Handler handler = new EC02Handler();
  57 + System.out.println(handler.verifyAFConfig(conf));
  58 + System.out.println(TestDebugMsg.formatXml(handler.handle(reqMessage,
  59 + 100000)));
  60 +
  61 + // int max=100;
  62 + // for(int i=0; i<=max; i++)
  63 + // {
  64 + // ProcessingThread pt = new ProcessingThread(conf, reqMessage);
  65 + // Thread t = new Thread(pt, "t"+String.valueOf(i));
  66 + // t.start();
  67 + // }
  68 + }
  69 +
  70 + public static String formatXml(String xml) {
  71 + try {
  72 + Transformer serializer = TransformerFactory.newInstance()
  73 + .newTransformer();
  74 + serializer.setOutputProperty(OutputKeys.INDENT, "yes");
  75 + serializer.setOutputProperty(
  76 + "{http://xml.apache.org/xslt}indent-amount", "4");
  77 + Source xmlSource = new SAXSource(new InputSource(
  78 + new ByteArrayInputStream(xml.getBytes())));
  79 + StreamResult res = new StreamResult(new ByteArrayOutputStream());
  80 + serializer.transform(xmlSource, res);
  81 + return new String(
  82 + ((ByteArrayOutputStream) res.getOutputStream())
  83 + .toByteArray());
  84 + } catch (Exception e) {
  85 + return xml;
  86 + }
  87 + }
  88 +}
  89 +
  90 +class ProcessingThread1 implements Runnable {
  91 + private String conf;
  92 + private String reqMessage;
  93 +
  94 + public ProcessingThread1(String _conf, String _msg) {
  95 + this.conf = _conf;
  96 + this.reqMessage = _msg;
  97 + }
  98 +
  99 + @Override
  100 + public void run() {
  101 + EC02Handler handler = new EC02Handler();
  102 + System.out.println(handler.verifyAFConfig(conf));
  103 + System.out.println(TestDebugMsg.formatXml(handler.handle(reqMessage,
  104 + 100000)));
  105 + }
  106 +}
... ...
src/th/co/ais/ssbsrfc/control/TestMain.java 0 → 100644
... ... @@ -0,0 +1,142 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.xml.bind.JAXBContext;
  6 +import javax.xml.bind.JAXBElement;
  7 +import javax.xml.bind.Unmarshaller;
  8 +import javax.xml.bind.annotation.XmlAccessType;
  9 +import javax.xml.bind.annotation.XmlAccessorType;
  10 +import javax.xml.bind.annotation.XmlAttribute;
  11 +import javax.xml.bind.annotation.XmlElement;
  12 +import javax.xml.bind.annotation.XmlRootElement;
  13 +import javax.xml.stream.XMLInputFactory;
  14 +import javax.xml.stream.XMLStreamReader;
  15 +import javax.xml.transform.stream.StreamSource;
  16 +
  17 +
  18 +@XmlAccessorType(XmlAccessType.FIELD)
  19 +class Customer {
  20 +
  21 + @XmlElement(name="Version",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  22 + String Version;
  23 + @XmlElement(name="ResultCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  24 + String ResultCode;
  25 + @XmlElement(name="MsgLanguageCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  26 + String MsgLanguageCode;
  27 + @XmlElement(name="ResultDesc",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  28 + String ResultDesc;
  29 + @XmlElement(name="AcctKey",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  30 + String AcctKey;
  31 +
  32 + @XmlElement(name="AdjustmentInfo",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  33 + List<AdjustmentInfo> AdjustmentInfo;
  34 +}
  35 +class AdjustmentInfo{
  36 +
  37 + String BalanceType;
  38 + String BalanceID;
  39 + String BalanceTypeName;
  40 + String OldBalanceAmt;
  41 + String NewBalanceAmt;
  42 + String CurrencyID;
  43 +
  44 + @XmlElement(name="BalanceID",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  45 + public String getBalanceID() {
  46 + return BalanceID;
  47 + }
  48 +
  49 + public void setBalanceID(String balanceID) {
  50 + BalanceID = balanceID;
  51 + }
  52 +
  53 + @XmlElement(name="BalanceTypeName",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  54 + public String getBalanceTypeName() {
  55 + return BalanceTypeName;
  56 + }
  57 +
  58 + public void setBalanceTypeName(String balanceTypeName) {
  59 + BalanceTypeName = balanceTypeName;
  60 + }
  61 +
  62 + @XmlElement(name="OldBalanceAmt",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  63 + public String getOldBalanceAmt() {
  64 + return OldBalanceAmt;
  65 + }
  66 +
  67 + public void setOldBalanceAmt(String oldBalanceAmt) {
  68 + OldBalanceAmt = oldBalanceAmt;
  69 + }
  70 +
  71 + @XmlElement(name="NewBalanceAmt",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  72 + public String getNewBalanceAmt() {
  73 + return NewBalanceAmt;
  74 + }
  75 +
  76 + public void setNewBalanceAmt(String newBalanceAmt) {
  77 + NewBalanceAmt = newBalanceAmt;
  78 + }
  79 +
  80 + @XmlElement(name="CurrencyID",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  81 + public String getCurrencyID() {
  82 + return CurrencyID;
  83 + }
  84 +
  85 + public void setCurrencyID(String currencyID) {
  86 + CurrencyID = currencyID;
  87 + }
  88 +
  89 + @XmlElement(name="BalanceType",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  90 + public String getBalanceType() {
  91 + return BalanceType;
  92 + }
  93 +
  94 + public void setBalanceType(String BalanceType) {
  95 + this.BalanceType = BalanceType;
  96 + }
  97 +
  98 +
  99 +}
  100 +
  101 +
  102 +public class TestMain {
  103 +
  104 + public static void main(String[] args) throws Exception {
  105 +
  106 + XMLInputFactory xif = XMLInputFactory.newFactory();
  107 + StreamSource xml = new StreamSource("D:\\car.xml");
  108 + XMLStreamReader xsr = xif.createXMLStreamReader(xml);
  109 + xsr.nextTag();
  110 + while(!xsr.getLocalName().equals("ResultHeader")) {
  111 + xsr.nextTag();
  112 + System.out.println(xsr.getLocalName());
  113 + System.out.println(xsr.hasNext());
  114 + }
  115 + System.out.println(xsr.hasNext());
  116 + xsr.next();
  117 + /*while(!xsr.getLocalName().equals("AdjustmentResult")) {
  118 + xsr.nextTag();
  119 + }*/
  120 +
  121 + JAXBContext jc = JAXBContext.newInstance(Customer.class);
  122 + Unmarshaller unmarshaller = jc.createUnmarshaller();
  123 + JAXBElement<Customer> jb = unmarshaller.unmarshal(xsr, Customer.class);
  124 + xsr.close();
  125 +
  126 + Customer customer = jb.getValue();
  127 + System.out.println("Version:"+customer.Version);
  128 + System.out.println("ResultCode:"+customer.ResultCode);
  129 + System.out.println("MsgLanguageCode:"+customer.MsgLanguageCode);
  130 + System.out.println("ResultDesc:"+customer.ResultDesc);
  131 + /*System.out.println("AcctKey:"+customer.AcctKey);
  132 + System.out.println("BalanceID:"+customer.AdjustmentInfo.get(0).getBalanceID());
  133 + System.out.println("BalanceType:"+customer.AdjustmentInfo.get(0).getBalanceType());
  134 + System.out.println("BalanceTypeName:"+customer.AdjustmentInfo.get(0).getBalanceTypeName());
  135 + System.out.println("CurrencyID:"+customer.AdjustmentInfo.get(0).CurrencyID);
  136 + System.out.println("NewBalanceAmt:"+customer.AdjustmentInfo.get(0).NewBalanceAmt);
  137 + System.out.println("OldBalanceAmt:"+customer.AdjustmentInfo.get(0).OldBalanceAmt);*/
  138 +
  139 +
  140 + }
  141 +}
  142 +
... ...
src/th/co/ais/ssbsrfc/control/mainAF.java 0 → 100644
... ... @@ -0,0 +1,129 @@
  1 +package th.co.ais.ssbsrfc.control;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.config.StateConfig;
  6 +import th.co.ais.ssbsrfc.instance.AFInstance;
  7 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  8 +import th.co.ais.ssbsrfc.utils.Global;
  9 +import ec02.af.abstracts.AbstractAF;
  10 +import ec02.af.data.ECDialogue;
  11 +import ec02.af.data.EquinoxProperties;
  12 +import ec02.af.data.EquinoxRawData;
  13 +import ec02.af.exception.ActionProcessException;
  14 +import ec02.af.exception.ComposeInstanceException;
  15 +import ec02.af.exception.ConstructRawDataException;
  16 +import ec02.af.exception.ExtractInstanceException;
  17 +import ec02.af.exception.ExtractRawDataException;
  18 +import ec02.interfaces.IEC02;
  19 +import ec02.utils.AppLog;
  20 +
  21 +public class mainAF extends AbstractAF implements IEC02 {
  22 +
  23 + @Override
  24 + public ECDialogue actionProcess(EquinoxProperties eqxProp,
  25 + ArrayList<EquinoxRawData> eqxRawDataList, Object instance)
  26 + throws ActionProcessException {
  27 + AppLog.d("[CURRENT STATE] : " + eqxProp.getState());
  28 + EC02Instance ec02Ins = (EC02Instance) instance;
  29 + ec02Ins.setEquinoxProperties(eqxProp);
  30 + ec02Ins.setAbstractAF((AbstractAF) this);
  31 + ec02Ins.getAFInstance().setStartFlowTimeStampForEmpty();
  32 +
  33 + String currentState = eqxProp.getState();
  34 +
  35 + StateManager sm = new StateManager(currentState);
  36 + String eqxState = sm.doAction((AbstractAF) this, ec02Ins, eqxRawDataList);
  37 + EquinoxProperties newEqxProp = new EquinoxProperties();
  38 + newEqxProp.setState(eqxState);
  39 + // TODO must be have function to calculate timeout
  40 + newEqxProp.setTimeout(ec02Ins.getTimeout());
  41 + ECDialogue ecDialogue = new ECDialogue(newEqxProp, ec02Ins);
  42 + return ecDialogue;
  43 + }
  44 +
  45 + @Override
  46 + public boolean verifyAFConfiguration(String arg0) {
  47 + // TODO Auto-generated method stub
  48 + return true;
  49 + }
  50 +
  51 + /*
  52 + * 5.4 ComposeInstance Module
  53 + */
  54 + @Override
  55 + public String composeInstance(Object instance) throws ComposeInstanceException {
  56 + // 1. Read instance into variable
  57 + EC02Instance ec02Instance = (EC02Instance) instance;
  58 + AFInstance afInstance = ec02Instance.getAFInstance();
  59 + String encodeString = "";
  60 + // 2. try to encode instanceData bean object into string format
  61 + try {
  62 + encodeString = Global.encodeInstance(afInstance);
  63 + }
  64 + catch (Exception e) {
  65 + e.printStackTrace();
  66 + }
  67 + // 3. return instanceData in string format
  68 + return encodeString;
  69 + }
  70 +
  71 + /*
  72 + * 5.3 ConstructRawData Module
  73 + */
  74 + @Override
  75 + public ArrayList<EquinoxRawData> constructRawData(Object instance)
  76 + throws ConstructRawDataException {
  77 + // 1. Read instance into variable
  78 + EC02Instance ins = (EC02Instance) instance;
  79 + ArrayList<EquinoxRawData> list = ins.getEqxRawDataList();
  80 + // 2. Return equinox raw data
  81 + return list;
  82 + }
  83 +
  84 + /*
  85 + * 5.1 ExtractInstance Module
  86 + */
  87 + @Override
  88 + public Object extractInstance(String instance) throws ExtractInstanceException {
  89 +
  90 + EC02Instance ec02Instance = new EC02Instance();
  91 + AFInstance afInstance = null;
  92 +
  93 + // 1. Check instance data from equinox is null or not
  94 + if ((instance == null) || instance.isEmpty()) {
  95 + // 1.1. If instance data is null, create new instanceData bean object
  96 + afInstance = new AFInstance();
  97 + }
  98 + else {
  99 + // 1.2. If instance data is not null, try to decode instance to instanceData bean object
  100 + try {
  101 + afInstance = Global.decodeInstance(instance);
  102 + }
  103 + catch (Exception e) {
  104 + e.printStackTrace();
  105 + }
  106 + }
  107 + ec02Instance.setAFInstance(afInstance);
  108 + // 2. return instanceData bean object
  109 + return (Object) ec02Instance;
  110 + }
  111 +
  112 + /*
  113 + * 5.2 ExtractRawData Module
  114 + */
  115 + @Override
  116 + public void extractRawData(Object instanceData, ArrayList<EquinoxRawData> rawDatas)
  117 + throws ExtractRawDataException {
  118 + EC02Instance ec02Instance = (EC02Instance) instanceData;
  119 + // 1. Loop RawData
  120 + for (EquinoxRawData r : rawDatas) {
  121 + // 1.1. Get event type from equinox raw data
  122 + String eventType = StateConfig.getEventTypeFromEquinoxRawData(ec02Instance, r);
  123 + // 1.1.7. Set raw event type = event type
  124 + r.setRawEventType(eventType);
  125 + ec02Instance.getAFInstance().listTimeoutRemove(r.getInvoke());
  126 + AppLog.d("[eventType] : " + eventType);
  127 + }
  128 + }
  129 +}
... ...
src/th/co/ais/ssbsrfc/instance/AFInstance.java 0 → 100644
... ... @@ -0,0 +1,424 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.LinkedHashMap;
  6 +import java.util.Map;
  7 +
  8 +import th.co.ais.ssbsrfc.config.Invoke;
  9 +import th.co.ais.ssbsrfc.config.StateConfig;
  10 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  11 +import th.co.ais.ssbsrfc.utils.Global;
  12 +import th.co.ais.ssbsrfc.utils.Log;
  13 +import ais.mmt.sand.comlog.DetailsLogPrototype;
  14 +import ais.mmt.sand.comlog.SummaryLogPrototype;
  15 +import ec02.utils.AppLog;
  16 +
  17 +public class AFInstance {
  18 +
  19 + private int gDialogueId = -1;
  20 + private ArrayList<FMInstance> listFlow;
  21 + private Map<String, FMInstance> dicInvoke;
  22 + private ArrayList<Timeout> globalListTimeout;
  23 + // managetimeout
  24 + private ArrayList<Timeout> listTimeout;
  25 + private int flow = 0;
  26 + private ArrayList<Object> input = null; /** Detail Log Input **/
  27 + private ArrayList<Object> output = null; /** Detail Log Output **/
  28 + private ArrayList<Stat> listStat;
  29 + private ArrayList<String> listConditionStat;
  30 + private SummaryLogPrototype sumlog = null; /** Summary Log **/
  31 + private DetailsLogPrototype detaillog = null; /** Detail Log **/
  32 + private BackupSummary backupSummary = null;
  33 + private Map<String, String> mapHttpData = null;
  34 + private HashMap<String, Response> listOrig;
  35 + private String orig = null;
  36 + private String invoke = null;
  37 + private String currentState = StateConfig.SSTATE_END;
  38 + private String previousState = StateConfig.SSTATE_BEGIN;
  39 + private String outgoingStateTimeStamp = null;
  40 + private String startFlowTimeStamp = null;
  41 + private String initialInvoke = null;
  42 + private String resultCode = null;
  43 + private String resultDescription = null;
  44 + private String responseTime = null;
  45 + private String processingTime = null;
  46 + private String acknowledgeTime = null;
  47 + private String dialogueId = null;
  48 + private Map<String, RetryIns> dicRetry = null;
  49 +
  50 + private AdjustmentRequestIns adjustmentRequestIns = null;
  51 +
  52 + public AdjustmentRequestIns getAdjustmentRequestIns() {
  53 + return adjustmentRequestIns;
  54 + }
  55 + public void setAdjustmentRequestIns(AdjustmentRequestIns adjustmentRequestIns) {
  56 + this.adjustmentRequestIns = adjustmentRequestIns;
  57 + }
  58 + public String getOrig() {
  59 + return orig;
  60 + }
  61 + public void setOrig(String orig) {
  62 + this.orig = orig;
  63 + }
  64 + public String getInvoke() {
  65 + return invoke;
  66 + }
  67 + public void setInvoke(String invoke) {
  68 + this.invoke = invoke;
  69 + }
  70 + public String getCurrentState() {
  71 + return currentState;
  72 + }
  73 + public void setCurrentState(String currentState) {
  74 + if (this.currentState.equals(StateConfig.SSTATE_END)) {
  75 + this.setPreviousState(StateConfig.SSTATE_BEGIN);
  76 + } else if (!this.currentState.equals(currentState)) {
  77 + this.setPreviousState(this.currentState);
  78 + }
  79 + this.currentState = currentState;
  80 + }
  81 + public String getPreviousState() {
  82 + return previousState;
  83 + }
  84 + public void setPreviousState(String previousState) {
  85 + this.previousState = previousState;
  86 + }
  87 + public Map<String, String> getMapHttpData() {
  88 + if (mapHttpData == null) {
  89 + mapHttpData = new HashMap<String, String>();
  90 + }
  91 + return mapHttpData;
  92 + }
  93 +
  94 + public void setMapHttpData(Map<String, String> mapHttpData) {
  95 + this.mapHttpData = mapHttpData;
  96 + }
  97 + public HashMap<String, Response> getListOrig() {
  98 + if (listOrig == null) {
  99 + listOrig = new HashMap<String, Response>();
  100 + }
  101 + return listOrig;
  102 + }
  103 +
  104 + public void setListOrig(HashMap<String, Response> listOrig) {
  105 + this.listOrig = listOrig;
  106 + }
  107 +
  108 + public void setListOrigKey(String key, Response value) {
  109 + this.listOrig.put(key, value);
  110 + }
  111 +
  112 + public Response getListOrigForKey(String key) {
  113 + return listOrig.get(key);
  114 + }
  115 +
  116 + public void setListOrigKeyRemove(String key) {
  117 + this.listOrig.remove(key);
  118 + }
  119 +
  120 + public int getFlow() {
  121 + return flow;
  122 + }
  123 + public void setFlow(int flow) {
  124 + if (this.flow == 0) {
  125 + this.flow = flow;
  126 + Global.flow = flow;
  127 + }
  128 + }
  129 + public void setForceFlow(int flow) {
  130 + this.flow = flow;
  131 + }
  132 + public void clearFlow()
  133 + {
  134 + this.flow = 0;
  135 + }
  136 + public ArrayList<Timeout> getListTimeout() {
  137 + if (listTimeout == null) {
  138 + listTimeout = new ArrayList<Timeout>();
  139 + }
  140 + return listTimeout;
  141 + }
  142 + public void setListTimeout(ArrayList<Timeout> listTimeout) {
  143 + this.listTimeout = listTimeout;
  144 + }
  145 + public void listTimeoutRemove(String name) {
  146 + ArrayList<Timeout> lTimeout = this.getListTimeout();
  147 + for (Timeout timeout : lTimeout) {
  148 + if (timeout.getName() != null && timeout.getName().equals(name)) {
  149 + this.getListTimeout().remove(timeout);
  150 + break;
  151 + }
  152 + }
  153 + // check remove all for eventType
  154 + listTimeoutRemoveForEventType(new Invoke(name).eventType);
  155 + }
  156 + public void listTimeoutRemoveForEventType(String _eventType) {
  157 + ArrayList<Timeout> lTimeout = new ArrayList<Timeout>();
  158 + for (Timeout timeout : this.getListTimeout()) {
  159 + if (timeout.getName() != null & timeout.getName().contains(".")) {
  160 + String eventType = new Invoke(timeout.getName()).eventType;
  161 + if (eventType.equals(_eventType)) {
  162 + lTimeout.add(timeout);
  163 + }
  164 + }
  165 + }
  166 + for (Timeout timeout : lTimeout) {
  167 + this.getListTimeout().remove(timeout);
  168 + if (Log.debug) {
  169 + AppLog.d("## RM TIMEOUT :" + timeout.getName());
  170 + }
  171 + }
  172 + }
  173 +
  174 + public boolean isTimeoutFotEventType(String _eventType) {
  175 + boolean isTrue = false;
  176 + for (Timeout timeout : this.getListTimeout()) {
  177 + if (timeout.getName() != null & timeout.getName().contains(".")) {
  178 + String eventType = new Invoke(timeout.getName()).eventType;
  179 + if (eventType.equals(_eventType)) {
  180 + isTrue = true;
  181 + }
  182 + }
  183 + }
  184 + return isTrue;
  185 + }
  186 +
  187 + public ArrayList<Timeout> getGlobalListTimeout() {
  188 + return globalListTimeout;
  189 + }
  190 + public void setGlobalListTimeout(ArrayList<Timeout> globalListTimeout) {
  191 + this.globalListTimeout = globalListTimeout;
  192 + }
  193 + public String getOutgoingStateTimeStamp() {
  194 + return outgoingStateTimeStamp;
  195 + }
  196 + public void setOutgoingStateTimeStamp(String outgoingStateTimeStamp) {
  197 + this.outgoingStateTimeStamp = outgoingStateTimeStamp;
  198 + }
  199 + public String getInitialInvoke() {
  200 + return initialInvoke;
  201 + }
  202 + public void setInitialInvoke(String initialInvoke) {
  203 + if (this.initialInvoke == null) {
  204 + this.initialInvoke = initialInvoke;
  205 + }
  206 + }
  207 + public void setForceInitialInvoke(String initialInvoke) {
  208 + this.initialInvoke = initialInvoke;
  209 + }
  210 + public void clearInitialInvoke() {
  211 + this.initialInvoke = null;
  212 + }
  213 + public String getStartFlowTimeStamp() {
  214 + return startFlowTimeStamp;
  215 + }
  216 + public void setStartFlowTimeStamp(String startFlowTimeStamp) {
  217 + this.startFlowTimeStamp = startFlowTimeStamp;
  218 + }
  219 + public String getResultCode() {
  220 + String tmp = resultCode;
  221 + if (resultCode == null || resultCode.equals(EQXMsg.EMPTY)) {
  222 + tmp = "null";
  223 + }
  224 + return tmp;
  225 + }
  226 + public void setResultCode(String resultCode) {
  227 + if (resultCode != null && !resultCode.equals("null")) {
  228 + this.resultCode = resultCode;
  229 + }
  230 + }
  231 + public String getResultDescription() {
  232 + String tmp = resultDescription;
  233 + if (resultDescription == null || resultDescription.equals(EQXMsg.EMPTY)) {
  234 + tmp = "null";
  235 + }
  236 + return tmp;
  237 + }
  238 + public void setResultDescription(String resultDescription) {
  239 + if (resultDescription != null && !resultDescription.equals("null")) {
  240 + this.resultDescription = resultDescription;
  241 + }
  242 + }
  243 + public void setStartFlowTimeStampForEmpty() {
  244 + long currentDateTime = System.currentTimeMillis();
  245 + String timeStamp = Global.getTimeStampLog(currentDateTime);
  246 + if (this.startFlowTimeStamp == null) {
  247 + this.startFlowTimeStamp = timeStamp;
  248 + Global.currentInputDateTime = currentDateTime;
  249 + }
  250 + this.setInputTimeStamp(timeStamp);
  251 + }
  252 + public void setInputTimeStamp(String inputTimeStamp) {
  253 + boolean bool = this.isOutgoingStateTimeStamp();
  254 + if (bool) {
  255 + long responseTime = 0;
  256 + try {
  257 + String input = this.getOutgoingStateTimeStamp();
  258 + String output = inputTimeStamp;
  259 + responseTime = Global.diffTimeStampLog(input, output);
  260 + } catch (Exception e) {
  261 + responseTime = 0;
  262 + }
  263 + this.setResponseTime("" + responseTime);
  264 + }
  265 + Global.inputTimeStamp = inputTimeStamp;
  266 + }
  267 + public boolean isOutgoingStateTimeStamp() {
  268 + boolean bool = false;
  269 + if (this.outgoingStateTimeStamp != null) {
  270 + bool = true;
  271 + }
  272 + return bool;
  273 + }
  274 + public String getResponseTime() {
  275 + return responseTime;
  276 + }
  277 + public void setResponseTime(String responseTime) {
  278 + this.responseTime = responseTime;
  279 + }
  280 + public String getProcessingTime() {
  281 + return processingTime;
  282 + }
  283 + public void setProcessingTime(String processingTime) {
  284 + this.processingTime = processingTime;
  285 + }
  286 + public String getAcknowledgeTime() {
  287 + return acknowledgeTime;
  288 + }
  289 + public void setAcknowledgeTime(String acknowledgeTime) {
  290 + this.acknowledgeTime = acknowledgeTime;
  291 + }
  292 + public void putInput(Object input) {
  293 + if (this.input == null) {
  294 + this.input = new ArrayList<Object>();
  295 + }
  296 + this.input.add(input);
  297 + }
  298 + public void putOutput(Object output) {
  299 + if (this.output == null) {
  300 + this.output = new ArrayList<Object>();
  301 + }
  302 + this.output.add(output);
  303 + }
  304 +
  305 + public ArrayList<Object> getInput() {
  306 + return input;
  307 + }
  308 + public void setInput(ArrayList<Object> input) {
  309 + this.input = input;
  310 + }
  311 + public ArrayList<Object> getOutput() {
  312 + return output;
  313 + }
  314 + public void setOutput(ArrayList<Object> output) {
  315 + this.output = output;
  316 + }
  317 + public ArrayList<Stat> getListStat() {
  318 + if (this.listStat == null) {
  319 + this.listStat = new ArrayList<Stat>();
  320 + }
  321 + return listStat;
  322 + }
  323 + public void setListStat(ArrayList<Stat> listStat) {
  324 + this.listStat = listStat;
  325 + }
  326 + public ArrayList<FMInstance> getListFlow() {
  327 + if (listFlow == null) {
  328 + listFlow = new ArrayList<FMInstance>();
  329 + }
  330 + return listFlow;
  331 + }
  332 + public void setListFlow(ArrayList<FMInstance> listFlow) {
  333 + this.listFlow = listFlow;
  334 + }
  335 + public void putListFlow(FMInstance ins)
  336 + {
  337 + this.listFlow.add(ins);
  338 + }
  339 + public void removeListFlow(FMInstance ins)
  340 + {
  341 + this.listFlow.remove(ins);
  342 + }
  343 + public Map<String, FMInstance> getDicInvoke() {
  344 + if (dicInvoke == null) {
  345 + dicInvoke = new LinkedHashMap<String, FMInstance>();
  346 + }
  347 + return dicInvoke;
  348 + }
  349 + public void setDicInvoke(Map<String, FMInstance> dicInvoke) {
  350 + this.dicInvoke = dicInvoke;
  351 + }
  352 + public void putDicInvoke(String key, FMInstance value)
  353 + {
  354 + this.getDicInvoke().put(key, value);
  355 + }
  356 + public SummaryLogPrototype getSumlog() {
  357 + if (sumlog == null) {
  358 + sumlog = SummaryLogPrototype.getInstance(StateConfig.PROJECT_NAME);
  359 + }
  360 + return sumlog;
  361 + }
  362 + public void setSumlog(SummaryLogPrototype sumlog) {
  363 + this.sumlog = sumlog;
  364 + }
  365 + public DetailsLogPrototype getDetaillog() {
  366 + if (detaillog == null) {
  367 + detaillog = DetailsLogPrototype.getInstance(StateConfig.PROJECT_NAME);
  368 + }
  369 + return detaillog;
  370 + }
  371 + public void setDetaillog(DetailsLogPrototype detaillog) {
  372 + this.detaillog = detaillog;
  373 + }
  374 + public BackupSummary getBackupSummary() {
  375 + if (this.backupSummary == null) {
  376 + this.backupSummary = new BackupSummary();
  377 + }
  378 + return backupSummary;
  379 + }
  380 + public void setBackupSummary(BackupSummary backupSummary) {
  381 + this.backupSummary = backupSummary;
  382 + }
  383 + public String getDialogueId() {
  384 + if(this.gDialogueId == -1) {
  385 + this.gDialogueId = Global.minDialogueId;
  386 + }
  387 + this.dialogueId = String.format("%02d", this.gDialogueId);
  388 + this.gDialogueId++;
  389 + if(this.gDialogueId == Global.maxDialogueId + 1) {
  390 + this.gDialogueId = Global.minDialogueId;
  391 + }
  392 + return dialogueId;
  393 + }
  394 + public String getDialogueIdForMultiFlow() {
  395 + return dialogueId;
  396 + }
  397 + public void setDialogueId(String dialogueId) {
  398 + this.dialogueId = dialogueId;
  399 + }
  400 + public int getGlobalDialogueId() {
  401 + return this.gDialogueId;
  402 + }
  403 + public void setGlobalDialogueId(int globalDialogueId) {
  404 + this.gDialogueId = globalDialogueId;
  405 + }
  406 + public ArrayList<String> getListConditionStat() {
  407 + if (this.listConditionStat == null) {
  408 + this.listConditionStat = new ArrayList<String>();
  409 + }
  410 + return this.listConditionStat;
  411 + }
  412 + public void setListConditionStat(ArrayList<String> listConditionStat) {
  413 + this.listConditionStat = listConditionStat;
  414 + }
  415 + public Map<String, RetryIns> getDicRetry() {
  416 + if (this.dicRetry == null) {
  417 + this.dicRetry = new LinkedHashMap<String, RetryIns>();
  418 + }
  419 + return this.dicRetry;
  420 + }
  421 + public void setDicRetry(Map<String, RetryIns> dicRetry) {
  422 + this.dicRetry = dicRetry;
  423 + }
  424 +}
... ...
src/th/co/ais/ssbsrfc/instance/AccessSecurity.java 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class AccessSecurity {
  6 +
  7 + private String LoginSystemCode;
  8 + private String Password;
  9 +
  10 + @XmlElement(name="LoginSystemCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  11 + public String getLoginSystemCode() {
  12 + return LoginSystemCode;
  13 + }
  14 + public void setLoginSystemCode(String loginSystemCode) {
  15 + LoginSystemCode = loginSystemCode;
  16 + }
  17 +
  18 + @XmlElement(name="Password",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  19 + public String getPassword() {
  20 + return Password;
  21 + }
  22 + public void setPassword(String password) {
  23 + Password = password;
  24 + }
  25 +
  26 +}
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentInfo.java 0 → 100644
... ... @@ -0,0 +1,80 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class AdjustmentInfo {
  6 +
  7 + String BalanceType;
  8 + String AdjustmentType;
  9 + String AdjustmentAmt;
  10 + String CurrencyID;
  11 + String BalanceID;
  12 + String BalanceTypeName;
  13 + String OldBalanceAmt;
  14 + String NewBalanceAmt;
  15 +
  16 + @XmlElement(name="BalanceType",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  17 + public String getBalanceType() {
  18 + return BalanceType;
  19 + }
  20 + public void setBalanceType(String balanceType) {
  21 + BalanceType = balanceType;
  22 + }
  23 +
  24 + @XmlElement(name="AdjustmentType",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  25 + public String getAdjustmentType() {
  26 + return AdjustmentType;
  27 + }
  28 + public void setAdjustmentType(String adjustmentType) {
  29 + AdjustmentType = adjustmentType;
  30 + }
  31 +
  32 + @XmlElement(name="BalanceID",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  33 + public String getBalanceID() {
  34 + return BalanceID;
  35 + }
  36 + public void setBalanceID(String balanceID) {
  37 + BalanceID = balanceID;
  38 + }
  39 +
  40 + @XmlElement(name="BalanceTypeName",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  41 + public String getBalanceTypeName() {
  42 + return BalanceTypeName;
  43 + }
  44 + public void setBalanceTypeName(String balanceTypeName) {
  45 + BalanceTypeName = balanceTypeName;
  46 + }
  47 +
  48 + @XmlElement(name="OldBalanceAmt",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  49 + public String getOldBalanceAmt() {
  50 + return OldBalanceAmt;
  51 + }
  52 + public void setOldBalanceAmt(String oldBalanceAmt) {
  53 + OldBalanceAmt = oldBalanceAmt;
  54 + }
  55 +
  56 + @XmlElement(name="NewBalanceAmt",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  57 + public String getNewBalanceAmt() {
  58 + return NewBalanceAmt;
  59 + }
  60 + public void setNewBalanceAmt(String newBalanceAmt) {
  61 + NewBalanceAmt = newBalanceAmt;
  62 + }
  63 +
  64 + @XmlElement(name="AdjustmentAmt",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  65 + public String getAdjustmentAmt() {
  66 + return AdjustmentAmt;
  67 + }
  68 + public void setAdjustmentAmt(String adjustmentAmt) {
  69 + AdjustmentAmt = adjustmentAmt;
  70 + }
  71 +
  72 + @XmlElement(name="CurrencyID",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  73 + public String getCurrencyID() {
  74 + return CurrencyID;
  75 + }
  76 + public void setCurrencyID(String currencyID) {
  77 + CurrencyID = currencyID;
  78 + }
  79 +
  80 +}
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentObj.java 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class AdjustmentObj {
  6 +
  7 + private SubAccessCode subAccessCode;
  8 +
  9 + @XmlElement(name="SubAccessCode",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  10 + public SubAccessCode getSubAccessCode() {
  11 + return subAccessCode;
  12 + }
  13 +
  14 + public void setSubAccessCode(SubAccessCode subAccessCode) {
  15 + this.subAccessCode = subAccessCode;
  16 + }
  17 +
  18 +}
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentRequest.java 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class AdjustmentRequest {
  6 +
  7 + private String AdjustmentSerialNo;
  8 + private AdjustmentObj adjustmentObj;
  9 + private String OpType;
  10 + private AdjustmentInfo adjustmentInfo;
  11 +
  12 + @XmlElement(name="AdjustmentSerialNo",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  13 + public String getAdjustmentSerialNo() {
  14 + return AdjustmentSerialNo;
  15 + }
  16 + public void setAdjustmentSerialNo(String adjustmentSerialNo) {
  17 + AdjustmentSerialNo = adjustmentSerialNo;
  18 + }
  19 + @XmlElement(name="AdjustmentObj",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  20 + public AdjustmentObj getAdjustmentObj() {
  21 + return adjustmentObj;
  22 + }
  23 + public void setAdjustmentObj(AdjustmentObj adjustmentObj) {
  24 + this.adjustmentObj = adjustmentObj;
  25 + }
  26 + @XmlElement(name="OpType",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  27 + public String getOpType() {
  28 + return OpType;
  29 + }
  30 + public void setOpType(String opType) {
  31 + OpType = opType;
  32 + }
  33 + @XmlElement(name="AdjustmentInfo",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  34 + public AdjustmentInfo getAdjustmentInfo() {
  35 + return adjustmentInfo;
  36 + }
  37 + public void setAdjustmentInfo(AdjustmentInfo adjustmentInfo) {
  38 + this.adjustmentInfo = adjustmentInfo;
  39 + }
  40 +}
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentRequestIns.java 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +import javax.xml.bind.annotation.XmlRootElement;
  5 +import javax.xml.bind.annotation.XmlType;
  6 +
  7 +@XmlRootElement(name = "AdjustmentRequestMsg", namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  8 +@XmlType (propOrder={"requestHeader", "adjustmentRequest"})
  9 +public class AdjustmentRequestIns {
  10 +
  11 +
  12 + private RequestHeader RequestHeader;
  13 + private AdjustmentRequest AdjustmentRequest;
  14 +
  15 + @XmlElement(name="RequestHeader")
  16 + public RequestHeader getRequestHeader() {
  17 + return RequestHeader;
  18 + }
  19 + public void setRequestHeader(RequestHeader RequestHeader) {
  20 + this.RequestHeader = RequestHeader;
  21 + }
  22 + @XmlElement(name="AdjustmentRequest")
  23 + public AdjustmentRequest getAdjustmentRequest() {
  24 + return AdjustmentRequest;
  25 + }
  26 + public void setAdjustmentRequest(AdjustmentRequest AdjustmentRequest) {
  27 + this.AdjustmentRequest = AdjustmentRequest;
  28 + }
  29 +
  30 +}
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentResponseIns.java 0 → 100644
... ... @@ -0,0 +1,95 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.xml.bind.annotation.XmlElement;
  6 +import javax.xml.bind.annotation.XmlRootElement;
  7 +
  8 +
  9 +@XmlRootElement(name="AdjustmentRequestMsg",namespace ="http://www.huawei.com/bme/cbsinterface/arservices")
  10 +public class AdjustmentResponseIns {
  11 +
  12 + @XmlElement(name="Version",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  13 + String Version;
  14 + @XmlElement(name="ResultCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  15 + String ResultCode;
  16 + @XmlElement(name="MsgLanguageCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  17 + String MsgLanguageCode;
  18 + public String getVersion() {
  19 + return Version;
  20 + }
  21 +
  22 + public void setVersion(String version) {
  23 + Version = version;
  24 + }
  25 +
  26 + public String getResultCode() {
  27 + return ResultCode;
  28 + }
  29 +
  30 + public void setResultCode(String resultCode) {
  31 + ResultCode = resultCode;
  32 + }
  33 +
  34 + public String getMsgLanguageCode() {
  35 + return MsgLanguageCode;
  36 + }
  37 +
  38 + public void setMsgLanguageCode(String msgLanguageCode) {
  39 + MsgLanguageCode = msgLanguageCode;
  40 + }
  41 +
  42 + public String getResultDesc() {
  43 + return ResultDesc;
  44 + }
  45 +
  46 + public void setResultDesc(String resultDesc) {
  47 + ResultDesc = resultDesc;
  48 + }
  49 +
  50 + public String getAcctKey() {
  51 + return AcctKey;
  52 + }
  53 +
  54 + public void setAcctKey(String acctKey) {
  55 + AcctKey = acctKey;
  56 + }
  57 +
  58 + public List<AdjustmentInfo> getAdjustmentInfo() {
  59 + return AdjustmentInfo;
  60 + }
  61 +
  62 + public void setAdjustmentInfo(List<AdjustmentInfo> adjustmentInfo) {
  63 + AdjustmentInfo = adjustmentInfo;
  64 + }
  65 +
  66 + @XmlElement(name="ResultDesc",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  67 + String ResultDesc;
  68 + @XmlElement(name="AcctKey",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  69 + String AcctKey;
  70 +
  71 + @XmlElement(name="AdjustmentInfo",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  72 + List<AdjustmentInfo> AdjustmentInfo;
  73 +
  74 + /*@XmlElement(name = "ResultHeader")
  75 + List<ResultHeader> resultHeader;
  76 + @XmlElement(name = "AdjustmentResult")
  77 + List<AdjustmentResult> adjustmentResult;
  78 +
  79 + @XmlElement(name = "ResultHeader")
  80 + public List<ResultHeader> getResultHeader() {
  81 + return resultHeader;
  82 + }
  83 + @XmlElement(name = "AdjustmentResult")
  84 + public List<AdjustmentResult> getAdjustmentResult() {
  85 + return adjustmentResult;
  86 + }
  87 + public void setResultHeader(List<ResultHeader> resultHeader) {
  88 + this.resultHeader = resultHeader;
  89 + }
  90 + public void setAdjustmentResult(List<AdjustmentResult> adjustmentResult) {
  91 + this.adjustmentResult = adjustmentResult;
  92 + }*/
  93 +
  94 +
  95 +}
0 96 \ No newline at end of file
... ...
src/th/co/ais/ssbsrfc/instance/AdjustmentResult.java 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.xml.bind.annotation.XmlElement;
  6 +
  7 +public class AdjustmentResult {
  8 +
  9 + private String AcctKey;
  10 + @XmlElement(name = "AdjustmentInfo",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  11 + private List<AdjustmentInfo> adjustmentInfo;
  12 +
  13 + @XmlElement(name="AcctKey",namespace="http://www.huawei.com/bme/cbsinterface/arservices")
  14 + public String getAcctKey() {
  15 + return AcctKey;
  16 + }
  17 + public void setAcctKey(String acctKey) {
  18 + AcctKey = acctKey;
  19 + }
  20 + public List<AdjustmentInfo> getAdjustmentInfo() {
  21 + return adjustmentInfo;
  22 + }
  23 + public void setAdjustmentInfo(List<AdjustmentInfo> adjustmentInfo) {
  24 + this.adjustmentInfo = adjustmentInfo;
  25 + }
  26 +
  27 +
  28 +
  29 +}
... ...
src/th/co/ais/ssbsrfc/instance/BackupSummary.java 0 → 100644
... ... @@ -0,0 +1,84 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import th.co.ais.ssbsrfc.config.Constant;
  4 +import th.co.ais.ssbsrfc.utils.Global;
  5 +import ais.mmt.sand.comlog.SummaryLogPrototype;
  6 +import ec02.af.data.EquinoxRawData;
  7 +
  8 +
  9 +public class BackupSummary {
  10 + private int flow = -1;
  11 + private long requestTimestamp = -1;
  12 + private String initialInvoke = null;
  13 + private String resultCode = null;
  14 + private String resultDescription = null;
  15 + private SummaryLogPrototype sumLog = null;
  16 +
  17 + public BackupSummary() {
  18 + super();
  19 + }
  20 + public void backup(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
  21 + AFInstance ins = ec02Instance.getAFInstance();
  22 + this.flow = ins.getFlow();
  23 + this.requestTimestamp = Global.currentInputDateTime;
  24 + this.initialInvoke = ins.getInitialInvoke();
  25 + this.resultCode = ins.getResultCode();
  26 + this.resultDescription = ins.getResultDescription();
  27 + this.sumLog = ins.getSumlog();
  28 +
  29 + String input = Global.inputTimeStamp;
  30 + long reqTimestamp = Global.convertTocurrentTimeMillis(input);
  31 + String invoke = (equinoxRawData != null) ? equinoxRawData.getInvoke() : "";
  32 +
  33 + ec02Instance.getAFInstance().setForceFlow(Constant.FLOW_Unexpected_Event_Handling);
  34 + Global.currentInputDateTime = reqTimestamp;
  35 + ec02Instance.getAFInstance().setForceInitialInvoke(invoke);
  36 + ec02Instance.getAFInstance().setResultCode(null);
  37 + ec02Instance.getAFInstance().setResultDescription(null);
  38 + ec02Instance.getAFInstance().setSumlog(null);
  39 + }
  40 + public void restore(EC02Instance ec02Instance) {
  41 + ec02Instance.getAFInstance().setForceFlow(this.flow);
  42 + Global.currentInputDateTime = this.requestTimestamp;
  43 + ec02Instance.getAFInstance().setForceInitialInvoke(this.initialInvoke);
  44 + ec02Instance.getAFInstance().setResultCode(this.resultCode);
  45 + ec02Instance.getAFInstance().setResultDescription(this.resultDescription);
  46 + ec02Instance.getAFInstance().setSumlog(this.sumLog);
  47 + }
  48 + public int getFlow() {
  49 + return flow;
  50 + }
  51 + public void setFlow(int flow) {
  52 + this.flow = flow;
  53 + }
  54 + public long getRequestTimestamp() {
  55 + return requestTimestamp;
  56 + }
  57 + public void setRequestTimestamp(long requestTimestamp) {
  58 + this.requestTimestamp = requestTimestamp;
  59 + }
  60 + public String getInitialInvoke() {
  61 + return initialInvoke;
  62 + }
  63 + public void setInitialInvoke(String initialInvoke) {
  64 + this.initialInvoke = initialInvoke;
  65 + }
  66 + public String getResultCode() {
  67 + return resultCode;
  68 + }
  69 + public void setResultCode(String resultCode) {
  70 + this.resultCode = resultCode;
  71 + }
  72 + public String getResultDescription() {
  73 + return resultDescription;
  74 + }
  75 + public void setResultDescription(String resultDescription) {
  76 + this.resultDescription = resultDescription;
  77 + }
  78 + public SummaryLogPrototype getSumLog() {
  79 + return sumLog;
  80 + }
  81 + public void setSumLog(SummaryLogPrototype sumLog) {
  82 + this.sumLog = sumLog;
  83 + }
  84 +}
... ...
src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlAccessType;
  4 +import javax.xml.bind.annotation.XmlAccessorType;
  5 +import javax.xml.bind.annotation.XmlElement;
  6 +import javax.xml.bind.annotation.XmlRootElement;
  7 +
  8 +@XmlRootElement(name = "vcrr")
  9 +@XmlAccessorType(XmlAccessType.FIELD)
  10 +public class ChargeReportIns {
  11 +
  12 + private String Result;
  13 + private String Prepaidsubscriberflag;
  14 +
  15 + public String getResult() {
  16 + return Result;
  17 + }
  18 + public void setResult(String result) {
  19 + Result = result;
  20 + }
  21 + public String getPrepaidsubscriberflag() {
  22 + return Prepaidsubscriberflag;
  23 + }
  24 + public void setPrepaidsubscriberflag(String prepaidsubscriberflag) {
  25 + Prepaidsubscriberflag = prepaidsubscriberflag;
  26 + }
  27 +
  28 +
  29 +}
... ...
src/th/co/ais/ssbsrfc/instance/ChargeRequestIns.java 0 → 100644
... ... @@ -0,0 +1,84 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class ChargeRequestIns {
  4 +
  5 + private String page;
  6 + private String ms;
  7 + private String id;
  8 + private String mod;
  9 + private String cat;
  10 + private String dat;
  11 + private String fee;
  12 + private String pwd;
  13 + private String ssid;
  14 + private String nid;
  15 + private String scpid;
  16 +
  17 + public String getPage() {
  18 + return page;
  19 + }
  20 + public void setPage(String page) {
  21 + this.page = page;
  22 + }
  23 + public String getMs() {
  24 + return ms;
  25 + }
  26 + public void setMs(String ms) {
  27 + this.ms = ms;
  28 + }
  29 + public String getId() {
  30 + return id;
  31 + }
  32 + public void setId(String id) {
  33 + this.id = id;
  34 + }
  35 + public String getMod() {
  36 + return mod;
  37 + }
  38 + public void setMod(String mod) {
  39 + this.mod = mod;
  40 + }
  41 + public String getCat() {
  42 + return cat;
  43 + }
  44 + public void setCat(String cat) {
  45 + this.cat = cat;
  46 + }
  47 + public String getDat() {
  48 + return dat;
  49 + }
  50 + public void setDat(String dat) {
  51 + this.dat = dat;
  52 + }
  53 + public String getFee() {
  54 + return fee;
  55 + }
  56 + public void setFee(String fee) {
  57 + this.fee = fee;
  58 + }
  59 + public String getPwd() {
  60 + return pwd;
  61 + }
  62 + public void setPwd(String pwd) {
  63 + this.pwd = pwd;
  64 + }
  65 + public String getSsid() {
  66 + return ssid;
  67 + }
  68 + public void setSsid(String ssid) {
  69 + this.ssid = ssid;
  70 + }
  71 + public String getNid() {
  72 + return nid;
  73 + }
  74 + public void setNid(String nid) {
  75 + this.nid = nid;
  76 + }
  77 + public String getScpid() {
  78 + return scpid;
  79 + }
  80 + public void setScpid(String scpid) {
  81 + this.scpid = scpid;
  82 + }
  83 +
  84 +}
... ...
src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlAccessType;
  4 +import javax.xml.bind.annotation.XmlAccessorType;
  5 +import javax.xml.bind.annotation.XmlElement;
  6 +import javax.xml.bind.annotation.XmlRootElement;
  7 +
  8 +@XmlRootElement(name = "vcrr")
  9 +@XmlAccessorType(XmlAccessType.FIELD)
  10 +public class ChargeResponseIns {
  11 +
  12 + @XmlElement(name = "res")
  13 + private Element Result;
  14 + @XmlElement(name = "desc")
  15 + private Element desc;
  16 + @XmlElement(name = "id")
  17 + private Element ChargingID;
  18 + @XmlElement(name = "ppf")
  19 + private Element Prepaidsubscriberflag;
  20 +
  21 + public String getResult() {
  22 + return getElementValue(this.Result);
  23 + }
  24 +
  25 + public void setResult(String Result) {
  26 + this.Result = setElementValue(this.Result, Result);
  27 + }
  28 +
  29 + public String getdesc() {
  30 + return getElementValue(this.desc);
  31 + }
  32 +
  33 + public void setdesc(String desc) {
  34 + this.desc = setElementValue(this.desc, desc);
  35 + }
  36 +
  37 + public String getChargingID() {
  38 + return getElementValue(this.ChargingID);
  39 + }
  40 +
  41 + public void setChargingID(String ChargingID) {
  42 + this.ChargingID = setElementValue(this.ChargingID, ChargingID);
  43 + }
  44 +
  45 + public String getPrepaidsubscriberflag() {
  46 + return getElementValue(this.Prepaidsubscriberflag);
  47 + }
  48 +
  49 + public void setPrepaidsubscriberflag(String Prepaidsubscriberflag) {
  50 + this.Prepaidsubscriberflag = setElementValue(this.Prepaidsubscriberflag, Prepaidsubscriberflag);
  51 + }
  52 +
  53 + public static String getElementValue(Element element) {
  54 + if(element == null) {
  55 + return null;
  56 + } else {
  57 + return element.getValue();
  58 + }
  59 + }
  60 +
  61 + public static Element setElementValue(Element element, String value) {
  62 + if(value != null) {
  63 + if(element == null) {
  64 + element = new Element();
  65 + }
  66 + element.setValue(value);
  67 + } else {
  68 + return null;
  69 + }
  70 + return element;
  71 + }
  72 +
  73 +}
... ...
src/th/co/ais/ssbsrfc/instance/CheckRequest.java 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class CheckRequest {
  4 + private String dn;
  5 +
  6 + public String getDn() {
  7 + return dn;
  8 + }
  9 +
  10 + public void setDn(String dn) {
  11 + this.dn = dn;
  12 + }
  13 +
  14 +}
... ...
src/th/co/ais/ssbsrfc/instance/DetailLog.java 0 → 100644
... ... @@ -0,0 +1,54 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +
  4 +public class DetailLog {
  5 +
  6 + private DetailLogDetail _projectName_ = null;
  7 + private String CurrentState = "";
  8 + private String NextState = "";
  9 + private long ProcessingTime = -1;
  10 +
  11 + public DetailLog ()
  12 + { }
  13 +
  14 + public DetailLog(DetailLogDetail details, String currentState,
  15 + String nextState, long processingTime) {
  16 + super();
  17 + this._projectName_ = details;
  18 + CurrentState = currentState;
  19 + NextState = nextState;
  20 + ProcessingTime = processingTime;
  21 + }
  22 +
  23 + public DetailLogDetail getDetail() {
  24 + return _projectName_;
  25 + }
  26 +
  27 + public void setDetail(DetailLogDetail details) {
  28 + this._projectName_ = details;
  29 + }
  30 +
  31 + public String getCurrentState() {
  32 + return CurrentState;
  33 + }
  34 +
  35 + public void setCurrentState(String currentState) {
  36 + CurrentState = currentState;
  37 + }
  38 +
  39 + public String getNextState() {
  40 + return NextState;
  41 + }
  42 +
  43 + public void setNextState(String nextState) {
  44 + NextState = nextState;
  45 + }
  46 +
  47 + public long getProcessingTime() {
  48 + return ProcessingTime;
  49 + }
  50 +
  51 + public void setProcessingTime(long processingTime) {
  52 + ProcessingTime = processingTime;
  53 + }
  54 +}
... ...
src/th/co/ais/ssbsrfc/instance/DetailLogDetail.java 0 → 100644
... ... @@ -0,0 +1,98 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +public class DetailLogDetail {
  6 +
  7 + private String Session = "";
  8 + private String InitialInvoke = "";
  9 + private String Scenario = "";
  10 + private String MSISDN = "";
  11 + private ArrayList<Object> Input = null;
  12 + private String InputTimeStamp = "";
  13 + private ArrayList<Object> Output = null;
  14 + private String OutputTimeStamp = "";
  15 +
  16 + public DetailLogDetail ()
  17 + { }
  18 +
  19 + public DetailLogDetail(String session, String initialInvoke, String scenario,
  20 + String mSISDN, ArrayList<Object> input, String inputTimeStamp,
  21 + ArrayList<Object> output, String outputTimeStamp) {
  22 + super();
  23 + Session = session;
  24 + InitialInvoke = initialInvoke;
  25 + Scenario = scenario;
  26 + MSISDN = mSISDN;
  27 + Input = input;
  28 + InputTimeStamp = inputTimeStamp;
  29 + Output = output;
  30 + OutputTimeStamp = outputTimeStamp;
  31 + }
  32 +
  33 + public String getSession() {
  34 + return Session;
  35 + }
  36 +
  37 + public void setSession(String session) {
  38 + Session = session;
  39 + }
  40 +
  41 + public String getInitialInvoke() {
  42 + return InitialInvoke;
  43 + }
  44 +
  45 + public void setInitialInvoke(String initialInvoke) {
  46 + InitialInvoke = initialInvoke;
  47 + }
  48 +
  49 + public String getScenario() {
  50 + return Scenario;
  51 + }
  52 +
  53 + public void setScenario(String scenario) {
  54 + Scenario = scenario;
  55 + }
  56 +
  57 + public String getMSISDN() {
  58 + return MSISDN;
  59 + }
  60 +
  61 + public void setMSISDN(String mSISDN) {
  62 + MSISDN = mSISDN;
  63 + }
  64 +
  65 + public ArrayList<Object> getInput() {
  66 + return Input;
  67 + }
  68 +
  69 + public void setInput(ArrayList<Object> input) {
  70 + Input = input;
  71 + }
  72 +
  73 + public ArrayList<Object> getOutput() {
  74 + return Output;
  75 + }
  76 +
  77 + public void setOutput(ArrayList<Object> output) {
  78 + Output = output;
  79 + }
  80 +
  81 + public String getInputTimeStamp() {
  82 + return InputTimeStamp;
  83 + }
  84 +
  85 + public void setInputTimeStamp(String inputTimeStamp) {
  86 + InputTimeStamp = inputTimeStamp;
  87 + }
  88 +
  89 + public String getOutputTimeStamp() {
  90 + return OutputTimeStamp;
  91 + }
  92 +
  93 + public void setOutputTimeStamp(String outputTimeStamp) {
  94 + OutputTimeStamp = outputTimeStamp;
  95 + }
  96 +
  97 +
  98 +}
... ...
src/th/co/ais/ssbsrfc/instance/E01Atomic.java 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class E01Atomic {
  4 + private String command;
  5 + private String name;
  6 + private long value;
  7 + private long min;
  8 + private long max;
  9 +
  10 + public E01Atomic() {
  11 + super();
  12 + }
  13 + public E01Atomic(String command, String name, long value) {
  14 + super();
  15 + this.command = command;
  16 + this.name = name;
  17 + this.value = value;
  18 + }
  19 + public String getCommand() {
  20 + return command;
  21 + }
  22 + public void setCommand(String command) {
  23 + this.command = command;
  24 + }
  25 + public String getName() {
  26 + return name;
  27 + }
  28 + public void setName(String name) {
  29 + this.name = name;
  30 + }
  31 + public long getValue() {
  32 + return value;
  33 + }
  34 + public void setValue(long value) {
  35 + this.value = value;
  36 + }
  37 + public long getMin() {
  38 + return min;
  39 + }
  40 + public void setMin(long min) {
  41 + this.min = min;
  42 + }
  43 + public long getMax() {
  44 + return max;
  45 + }
  46 + public void setMax(long max) {
  47 + this.max = max;
  48 + }
  49 +}
... ...
src/th/co/ais/ssbsrfc/instance/E01Ins.java 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.message.MessageParser;
  6 +import th.co.ais.ssbsrfc.utils.Global;
  7 +import ec02.data.E01Data;
  8 +import ec02.utils.AppLog;
  9 +
  10 +public class E01Ins {
  11 + private ArrayList<E01Message> message;
  12 + private ArrayList<E01Message> atomic;
  13 +
  14 + public E01Ins() { }
  15 +
  16 + public E01Ins(String strJson) {
  17 + try {
  18 + ListE01Data listIns = (ListE01Data) MessageParser.fromJson(strJson, ListE01Data.class);
  19 +
  20 + for(E01Data ins : listIns.getListE01Data()) {
  21 + String command = ins.getCmdName();
  22 + String resultcode = ins.getResultCode();
  23 + String description = ins.getDescription();
  24 +
  25 + boolean isAtomic = ins.isAtomic();
  26 + E01Message e01Msg = null;
  27 + if(isAtomic) {
  28 + String name = ins.getAtomicName();
  29 + long value = ins.getAtomicValue();
  30 +
  31 + if(this.message == null) {
  32 + this.atomic = new ArrayList<E01Message>();
  33 + }
  34 +
  35 + e01Msg = new E01Message(command, resultcode, description, name, value);
  36 + this.atomic.add(e01Msg);
  37 + } else {
  38 + String id = ins.getId();
  39 + String objecttype = ins.getKeyObject() == null ? null : ins.getKeyObject().getObjectType();
  40 + String key0 = ins.getKeyObject() == null ? null : ins.getKeyObject().getKey0();
  41 + String key1 = ins.getKeyObject() == null ? null : ins.getKeyObject().getKey1();
  42 + String key2 = ins.getKeyObject() == null ? null : ins.getKeyObject().getKey2();
  43 + String key3 = ins.getKeyObject() == null ? null : ins.getKeyObject().getKey3();
  44 + String key4 = ins.getKeyObject() == null ? null : ins.getKeyObject().getKey4();
  45 + E01MessageData data = new E01MessageData(ins.getData());
  46 +
  47 + if(this.message == null) {
  48 + this.message = new ArrayList<E01Message>();
  49 + }
  50 +
  51 + e01Msg = new E01Message(command, resultcode, description, id, objecttype, key0, key1, key2, key3, key4, data);
  52 + this.message.add(e01Msg);
  53 + }
  54 +
  55 +
  56 + }
  57 +
  58 +// this.description = ins.getDescription();
  59 + } catch (Exception e) {
  60 + AppLog.e("## EXCEPTION :" + e.getMessage());
  61 + }
  62 + }
  63 +
  64 + @Override
  65 + public String toString() {
  66 + return Global.unescapePrintString(MessageParser.toJson(this));
  67 + }
  68 +
  69 + public ArrayList<E01Message> getMessage() {
  70 + return message;
  71 + }
  72 +
  73 + public void setMessage(ArrayList<E01Message> message) {
  74 + this.message = message;
  75 + }
  76 +
  77 + public ArrayList<E01Message> getAtomic() {
  78 + return atomic;
  79 + }
  80 +
  81 + public void setAtomic(ArrayList<E01Message> atomic) {
  82 + this.atomic = atomic;
  83 + }
  84 +}
  85 +
... ...
src/th/co/ais/ssbsrfc/instance/E01Instance.java 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +public class E01Instance {
  6 + private String cmd = "";
  7 + private String objType = "";
  8 + private String data = "";
  9 + private String id = "1";
  10 + private String Invoke = "";
  11 + private String serviceName = null;
  12 + private String timeout = null;
  13 + private ArrayList<String> key = null;
  14 +
  15 + public E01Instance() { }
  16 +
  17 + public String getCmd() {
  18 + return cmd;
  19 + }
  20 + public void setCmd(String cmd) {
  21 + this.cmd = cmd;
  22 + }
  23 + public String getObjType() {
  24 + return objType;
  25 + }
  26 + public void setObjType(String objType) {
  27 + this.objType = objType;
  28 + }
  29 + public String getData() {
  30 + return data;
  31 + }
  32 + public void setData(String data) {
  33 + this.data = data;
  34 + }
  35 + public ArrayList<String> getKey() {
  36 + return key;
  37 + }
  38 + public void setKey(ArrayList<String> key) {
  39 + this.key = key;
  40 + }
  41 + public String getId() {
  42 + return id;
  43 + }
  44 + public void setId(String id) {
  45 + this.id = id;
  46 + }
  47 + public String getInvoke() {
  48 + return Invoke;
  49 + }
  50 + public void setInvoke(String invoke) {
  51 + Invoke = invoke;
  52 + }
  53 + public String getServiceName() {
  54 + return serviceName;
  55 + }
  56 + public void setServiceName(String serviceName) {
  57 + this.serviceName = serviceName;
  58 + }
  59 + public String getTimeout() {
  60 + return timeout;
  61 + }
  62 + public void setTimeout(String timeout) {
  63 + this.timeout = timeout;
  64 + }
  65 +}
... ...
src/th/co/ais/ssbsrfc/instance/E01Message.java 0 → 100644
... ... @@ -0,0 +1,188 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +
  4 +public class E01Message {
  5 + private String command;
  6 + private String resultcode;
  7 + private String description;
  8 + private String name;
  9 + private String id;
  10 + private String objecttype;
  11 + private String key0;
  12 + private String key1;
  13 + private String key2;
  14 + private String key3;
  15 + private String key4;
  16 + private E01MessageData data;
  17 + private String value;
  18 +
  19 + public E01Message(String command, String resultcode, String description,
  20 + String id, String objecttype, String key0, String key1,
  21 + String key2, String key3, String key4, E01MessageData data) {
  22 + super();
  23 + this.command = command;
  24 + this.resultcode = resultcode;
  25 + this.id = id;
  26 + this.objecttype = objecttype;
  27 + this.key0 = key0;
  28 + this.key1 = key1;
  29 + this.key2 = key2;
  30 + this.key3 = key3;
  31 + this.key4 = key4;
  32 + this.data = data;
  33 + this.description = description;
  34 + }
  35 +
  36 + public E01Message(String command, String resultcode, String description, String name, long value) {
  37 + this.command = command;
  38 + this.resultcode = resultcode;
  39 + this.description = description;
  40 + this.name = name;
  41 + this.value = "" + value;
  42 + }
  43 +
  44 + public void setMode(String mode) {
  45 + if (mode.equals("res_replace")) {
  46 + this.objecttype = null;
  47 + this.key0 = null;
  48 + this.key1 = null;
  49 + this.key2 = null;
  50 + this.key3 = null;
  51 + this.key4 = null;
  52 + this.data = null;
  53 + }
  54 + }
  55 +
  56 + public String getCommand() {
  57 + return command;
  58 + }
  59 +
  60 + public void setCommand(String command) {
  61 + this.command = command;
  62 + }
  63 +
  64 + public String getResultcode() {
  65 + return resultcode;
  66 + }
  67 +
  68 + public void setResultcode(String resultcode) {
  69 + this.resultcode = resultcode;
  70 + }
  71 +
  72 + public String getId() {
  73 + return id;
  74 + }
  75 +
  76 + public void setId(String id) {
  77 + this.id = id;
  78 + }
  79 +
  80 + public String getObjecttype() {
  81 + return objecttype;
  82 + }
  83 +
  84 + public void setObjecttype(String objecttype) {
  85 + this.objecttype = objecttype;
  86 + }
  87 +
  88 + public String getKey0() {
  89 + return key0;
  90 + }
  91 +
  92 + public void setKey0(String key0) {
  93 + this.key0 = key0;
  94 + }
  95 +
  96 + public String getKey1() {
  97 + return key1;
  98 + }
  99 +
  100 + public void setKey1(String key1) {
  101 + this.key1 = key1;
  102 + }
  103 +
  104 + public String getKey2() {
  105 + return key2;
  106 + }
  107 +
  108 + public void setKey2(String key2) {
  109 + this.key2 = key2;
  110 + }
  111 +
  112 + public String getKey3() {
  113 + return key3;
  114 + }
  115 +
  116 + public void setKey3(String key3) {
  117 + this.key3 = key3;
  118 + }
  119 +
  120 + public String getKey4() {
  121 + return key4;
  122 + }
  123 +
  124 + public void setKey4(String key4) {
  125 + this.key4 = key4;
  126 + }
  127 +
  128 + public E01MessageData getData() {
  129 + return data;
  130 + }
  131 +
  132 + public void setData(E01MessageData data) {
  133 + this.data = data;
  134 + }
  135 +
  136 + public String getDataValue() {
  137 + return this.data.getValue();
  138 + }
  139 +
  140 + public void setDataValue(String value) {
  141 + this.data.setValue(value);
  142 + }
  143 +
  144 + public String getDescription() {
  145 + return description;
  146 + }
  147 +
  148 + public void setDescription(String description) {
  149 + this.description = description;
  150 + }
  151 +
  152 + public String getName() {
  153 + return name;
  154 + }
  155 +
  156 + public void setName(String name) {
  157 + this.name = name;
  158 + }
  159 +
  160 + public String getValue() {
  161 + return value;
  162 + }
  163 +
  164 + public void setValue(long value) {
  165 + this.value = "" + value;
  166 + }
  167 +
  168 + public void setValue(String value) {
  169 + this.value = value;
  170 + }
  171 +}
  172 +
  173 +class E01MessageData {
  174 + private String value;
  175 +
  176 + public E01MessageData(String value) {
  177 + super();
  178 + this.value = value;
  179 + }
  180 +
  181 + public String getValue() {
  182 + return value;
  183 + }
  184 +
  185 + public void setValue(String value) {
  186 + this.value = value;
  187 + }
  188 +}
... ...
src/th/co/ais/ssbsrfc/instance/EC02Instance.java 0 → 100644
... ... @@ -0,0 +1,81 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import ec02.af.abstracts.AbstractAF;
  6 +import ec02.af.data.EquinoxProperties;
  7 +import ec02.af.data.EquinoxRawData;
  8 +
  9 +public class EC02Instance {
  10 + private String orig = "";
  11 + private String timeout = "";
  12 + private String e01data = "";
  13 +
  14 + private EquinoxProperties eqxProp = null;
  15 + private AbstractAF abstractAF = null;
  16 + private E01Instance e01Ins = null;
  17 + private E01Atomic atomic = null;
  18 + private AFInstance afIns = null;
  19 + private ArrayList<EquinoxRawData> eqxRawDataList = null;
  20 +
  21 + public String getOrig() {
  22 + return orig;
  23 + }
  24 + public void setOrig(String orig) {
  25 + this.orig = orig;
  26 + }
  27 + public String getTimeout() {
  28 + return timeout;
  29 + }
  30 + public void setTimeout(String timeout) {
  31 + this.timeout = timeout;
  32 + }
  33 + public ArrayList<EquinoxRawData> getEqxRawDataList() {
  34 + return eqxRawDataList;
  35 + }
  36 + public void setEqxRawDataList(ArrayList<EquinoxRawData> eqxRawDataList) {
  37 + this.eqxRawDataList = eqxRawDataList;
  38 + }
  39 + public AFInstance getAFInstance() {
  40 + return afIns;
  41 + }
  42 + public void setAFInstance(AFInstance afIns) {
  43 + this.afIns = afIns;
  44 + }
  45 + public EquinoxProperties getEquinoxProperties() {
  46 + return eqxProp;
  47 + }
  48 + public void setEquinoxProperties(EquinoxProperties eqxProp) {
  49 + this.eqxProp = eqxProp;
  50 + }
  51 + public AbstractAF getAbstractAF() {
  52 + return abstractAF;
  53 + }
  54 + public void setAbstractAF(AbstractAF abstractAF) {
  55 + this.abstractAF = abstractAF;
  56 + }
  57 + public String getE01data() {
  58 + return e01data;
  59 + }
  60 + public void setE01data(String e01data) {
  61 + this.e01data = e01data;
  62 + }
  63 + public E01Instance getE01Ins() {
  64 + if(this.e01Ins == null) {
  65 + this.e01Ins = new E01Instance();
  66 + }
  67 + return e01Ins;
  68 + }
  69 + public void setE01Ins(E01Instance e01Ins) {
  70 + this.e01Ins = e01Ins;
  71 + }
  72 + public E01Atomic getAtomic() {
  73 + if (this.atomic == null) {
  74 + this.atomic = new E01Atomic();
  75 + }
  76 + return atomic;
  77 + }
  78 + public void setAtomic(E01Atomic atomic) {
  79 + this.atomic = atomic;
  80 + }
  81 +}
... ...
src/th/co/ais/ssbsrfc/instance/EQXRawInstance.java 0 → 100644
... ... @@ -0,0 +1,150 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +
  4 +public class EQXRawInstance {
  5 + private String to = null;
  6 + private String type = null;
  7 + private String ctype = null;
  8 + private String oid = null;
  9 + private String uri = null;
  10 + private String ecode = null;
  11 + private String message = "";
  12 + private String url = null;
  13 + private String method = null;
  14 + private String invoke = null;
  15 + private String name = null;
  16 + private String timeout = null;
  17 + private String subState = null;
  18 + private Object dataOutput = null;
  19 + private String nodeTo = "";
  20 + private String command = null;
  21 +
  22 + public String getInvoke() {
  23 + return invoke;
  24 + }
  25 +
  26 + public void setInvoke(String invoke) {
  27 + this.invoke = invoke;
  28 + }
  29 +
  30 + public String getTo() {
  31 + return to;
  32 + }
  33 +
  34 + public void setTo(String to) {
  35 + this.to = to;
  36 + }
  37 +
  38 + public String getType() {
  39 + return type;
  40 + }
  41 +
  42 + public void setType(String type) {
  43 + this.type = type;
  44 + }
  45 +
  46 + public String getCtype() {
  47 + return ctype;
  48 + }
  49 +
  50 + public void setCtype(String ctype) {
  51 + this.ctype = ctype;
  52 + }
  53 +
  54 + public String getOid() {
  55 + return oid;
  56 + }
  57 +
  58 + public void setOid(String oid) {
  59 + this.oid = oid;
  60 + }
  61 +
  62 + public String getUri() {
  63 + return uri;
  64 + }
  65 +
  66 + public void setUri(String uri) {
  67 + this.uri = uri;
  68 + }
  69 +
  70 + public String getEcode() {
  71 + return ecode;
  72 + }
  73 +
  74 + public void setEcode(String ecode) {
  75 + this.ecode = ecode;
  76 + }
  77 +
  78 + public String getMessage() {
  79 + return message;
  80 + }
  81 +
  82 + public void setMessage(String message) {
  83 + this.message = message;
  84 + }
  85 +
  86 + public String getUrl() {
  87 + return this.url;
  88 + }
  89 +
  90 + public void setUrl(String url) {
  91 + this.url = url;
  92 + }
  93 +
  94 + public String getMethod() {
  95 + return this.method;
  96 + }
  97 +
  98 + public void setMethod(String method) {
  99 + this.method = method;
  100 + }
  101 +
  102 + public String getName() {
  103 + return name;
  104 + }
  105 +
  106 + public void setName(String name) {
  107 + this.name = name;
  108 + }
  109 +
  110 + public String getTimeout() {
  111 + return timeout;
  112 + }
  113 +
  114 + public void setTimeout(String timeout) {
  115 + this.timeout = timeout;
  116 + }
  117 +
  118 + public String getSubState() {
  119 + return subState;
  120 + }
  121 +
  122 + public void setSubState(String subState) {
  123 + this.subState = subState;
  124 + }
  125 +
  126 + public Object getDataOutput() {
  127 + return dataOutput;
  128 + }
  129 +
  130 + public void setDataOutput(Object dataOutput) {
  131 + this.dataOutput = dataOutput;
  132 + }
  133 +
  134 + public String getNodeTo() {
  135 + return nodeTo;
  136 + }
  137 +
  138 + public void setNodeTo(String nodeTo) {
  139 + this.nodeTo = nodeTo;
  140 + }
  141 +
  142 + public String getCommand() {
  143 + return command;
  144 + }
  145 +
  146 + public void setCommand(String command) {
  147 + this.command = command;
  148 + }
  149 +
  150 +}
... ...
src/th/co/ais/ssbsrfc/instance/Element.java 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlAccessType;
  4 +import javax.xml.bind.annotation.XmlAccessorType;
  5 +import javax.xml.bind.annotation.XmlAttribute;
  6 +
  7 +@XmlAccessorType(XmlAccessType.FIELD)
  8 +public class Element {
  9 + @XmlAttribute(name="value")
  10 + private String value;
  11 +
  12 + public Element() { }
  13 +
  14 + public Element(String value) {
  15 + this.value = value;
  16 + }
  17 +
  18 + public String getValue() {
  19 + return value;
  20 + }
  21 +
  22 + public void setValue(String value) {
  23 + this.value = value;
  24 + }
  25 +
  26 +}
... ...
src/th/co/ais/ssbsrfc/instance/Encryption.java 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import th.co.ais.ssbsrfc.utils.DateUtil;
  4 +
  5 +public class Encryption {
  6 + private String uid = "";
  7 + private String msisdn = "";
  8 + private String datetime = "";
  9 +
  10 + public Encryption () {}
  11 +
  12 + public Encryption (String _uid, String _msisdn)
  13 + {
  14 + this.setUid(_uid);
  15 + this.setMsisdn(_msisdn);
  16 + this.setDatetime(DateUtil.getDateTimeNow());
  17 + }
  18 +
  19 + public String getUid() {
  20 + return uid;
  21 + }
  22 + public void setUid(String uid) {
  23 + this.uid = uid;
  24 + }
  25 + public String getMsisdn() {
  26 + return msisdn;
  27 + }
  28 + public void setMsisdn(String msisdn) {
  29 + this.msisdn = msisdn;
  30 + }
  31 + public String getDatetime() {
  32 + return datetime;
  33 + }
  34 + public void setDatetime(String datetime) {
  35 + this.datetime = datetime;
  36 + }
  37 +}
... ...
src/th/co/ais/ssbsrfc/instance/FMInstance.java 0 → 100644
... ... @@ -0,0 +1,72 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +
  4 +public class FMInstance {
  5 + private int flow = 0;
  6 + private String date = null;
  7 + private String data = null;
  8 + private String dialogueId = null;
  9 + private String unique = null;
  10 +
  11 + @Override
  12 + public String toString() {
  13 + return "## PARAMETERS: {\tflow=" + flow + ", \tdate=" + date
  14 + + ", \tdata=" + data + ", \tdialogueId=" + dialogueId
  15 + + ", \tunique=" + unique + "}";
  16 + }
  17 + public FMInstance() {
  18 + super();
  19 + }
  20 + public FMInstance(int flow) {
  21 + super();
  22 + this.flow = flow;
  23 + }
  24 + public FMInstance(int flow, String date) {
  25 + super();
  26 + this.flow = flow;
  27 + this.date = date;
  28 + }
  29 + public FMInstance(int flow, String date, String data) {
  30 + super();
  31 + this.flow = flow;
  32 + this.date = date;
  33 + this.data = data;
  34 + }
  35 + public FMInstance(int flow, String date, String data, String dialogueId) {
  36 + super();
  37 + this.flow = flow;
  38 + this.date = date;
  39 + this.data = data;
  40 + this.dialogueId = dialogueId;
  41 + }
  42 + public int getFlow() {
  43 + return flow;
  44 + }
  45 + public void setFlow(int flow) {
  46 + this.flow = flow;
  47 + }
  48 + public String getDate() {
  49 + return date;
  50 + }
  51 + public void setDate(String date) {
  52 + this.date = date;
  53 + }
  54 + public String getData() {
  55 + return data;
  56 + }
  57 + public void setData(String data) {
  58 + this.data = data;
  59 + }
  60 + public String getDialogueId() {
  61 + return dialogueId;
  62 + }
  63 + public void setDialogueId(String dialogueId) {
  64 + this.dialogueId = dialogueId;
  65 + }
  66 + public String getUnique() {
  67 + return unique;
  68 + }
  69 + public void setUnique(String unique) {
  70 + this.unique = unique;
  71 + }
  72 +}
... ...
src/th/co/ais/ssbsrfc/instance/ListE01Data.java 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.message.MessageParser;
  6 +import ec02.data.E01Data;
  7 +
  8 +public class ListE01Data {
  9 + private ArrayList<E01Data> listE01Data;
  10 +
  11 + public ListE01Data() { }
  12 +
  13 + public ListE01Data(ArrayList<E01Data> listE01Data) {
  14 + this.listE01Data = listE01Data;
  15 + }
  16 +
  17 + public ListE01Data(String strJson) {
  18 + ListE01Data ins = (ListE01Data) MessageParser.fromJson(strJson, ListE01Data.class);
  19 +
  20 + this.listE01Data = ins.listE01Data;
  21 + }
  22 +
  23 + public ArrayList<E01Data> getListE01Data() {
  24 + return listE01Data;
  25 + }
  26 +
  27 + public void setListE01Data(ArrayList<E01Data> listE01Data) {
  28 + this.listE01Data = listE01Data;
  29 + }
  30 +}
... ...
src/th/co/ais/ssbsrfc/instance/LogError.java 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class LogError {
  4 + private String ret = null;
  5 + private String description = null;
  6 +
  7 + public LogError(String ret, String description) {
  8 + super();
  9 + this.ret = ret;
  10 + this.description = description;
  11 + }
  12 + public String getRet() {
  13 + return ret;
  14 + }
  15 + public void setRet(String ret) {
  16 + this.ret = ret;
  17 + }
  18 + public String getDescription() {
  19 + return description;
  20 + }
  21 + public void setDescription(String description) {
  22 + this.description = description;
  23 + }
  24 +}
... ...
src/th/co/ais/ssbsrfc/instance/ManageTime.java 0 → 100644
... ... @@ -0,0 +1,274 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Calendar;
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
  7 +import java.util.Date;
  8 +import java.util.List;
  9 +
  10 +import th.co.ais.ssbsrfc.utils.DateUtil;
  11 +import th.co.ais.ssbsrfc.utils.Global;
  12 +import th.co.ais.ssbsrfc.utils.Log;
  13 +import ec02.utils.AppLog;
  14 +
  15 +public class ManageTime {
  16 +
  17 + private ArrayList<Timeout> listTimeout = new ArrayList<Timeout>();
  18 + private EC02Instance ec02Instance = null;
  19 +
  20 + public ManageTime() { }
  21 +
  22 + public ManageTime(EC02Instance ec02Instance) {
  23 + this.setStart(ec02Instance, true);
  24 + }
  25 +
  26 + public ManageTime(EC02Instance ec02Instance, boolean isSet) {
  27 + this.setStart(ec02Instance, isSet);
  28 + }
  29 +
  30 + public void setStart(EC02Instance ec02Instance, boolean isSet)
  31 + {
  32 + this.setEc02Instance(ec02Instance);
  33 + if (isSet) {
  34 + this.setListTimeout(ec02Instance.getAFInstance().getListTimeout());
  35 + }
  36 + }
  37 +
  38 + public Date getNow()
  39 + {
  40 + Date date = Calendar.getInstance().getTime();
  41 + return date;
  42 + }
  43 +
  44 + public int diffDate(Date date1, Date date2)
  45 + {
  46 + Calendar strF_Cal = Calendar.getInstance();
  47 + Calendar strL_Cal = Calendar.getInstance();
  48 + strF_Cal.setTime(date1);
  49 + strL_Cal.setTime(date2);
  50 + Calendar fCal = DateUtil.getCalendar(DateUtil.getDay(strF_Cal), DateUtil
  51 + .getMonth(strF_Cal), DateUtil.getYear(strF_Cal), DateUtil
  52 + .getHour(strF_Cal), DateUtil.getMinute(strF_Cal), DateUtil.getSecond(strF_Cal));
  53 + Calendar lCal = DateUtil.getCalendar(DateUtil.getDay(strL_Cal), DateUtil
  54 + .getMonth(strL_Cal), DateUtil.getYear(strL_Cal),
  55 + DateUtil.getHour(strL_Cal), DateUtil.getMinute(strL_Cal), DateUtil.getSecond(strL_Cal));
  56 +
  57 + long lastLong = lCal.getTime().getTime();
  58 + long firstLong = fCal.getTime().getTime();
  59 +
  60 + long diff = lastLong - firstLong;
  61 +
  62 + return (new Long(diff / 1000)).intValue();
  63 + }
  64 +
  65 + public String getTimeout(String name, String timeout)
  66 + {
  67 + Date now = this.getNow();
  68 +// System.out.println(name + ":" + timeout + ":" + now);
  69 + String time = this.getTimeout(name, timeout, now);
  70 + return time;
  71 + }
  72 +
  73 + public String getTimeout(String name, String timeout, Date now)
  74 + {
  75 + String inputTimeStamp = Global.inputTimeStamp;
  76 + for (Timeout item : this.getListTimeout()) {
  77 + if (inputTimeStamp == null) {
  78 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  79 + item.setNet(second);
  80 + } else {
  81 + if (!item.getInputTimeStamp().equals(inputTimeStamp)) {
  82 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  83 + item.setNet(second);
  84 + } else {
  85 + item.setDate(now);
  86 + }
  87 + }
  88 + }
  89 + Timeout state = new Timeout();
  90 + state.setName(name);
  91 + state.setInputTimeStamp(inputTimeStamp);
  92 + state.setDate(now);
  93 + state.setTimeout(Integer.parseInt(timeout));
  94 + state.setNet(Integer.parseInt(timeout));
  95 + this.getListTimeout().add(state);
  96 + Collections.sort(this.getListTimeout(), new Comparator<Timeout>(){
  97 + public int compare(Timeout p1, Timeout p2) {
  98 + return Integer.valueOf(p1.getNet()) .compareTo(Integer.valueOf(p2.getNet()));
  99 + }
  100 + });
  101 + this.getEc02Instance().getAFInstance().setListTimeout(this.getListTimeout());
  102 + String time = "";
  103 + if (this.getListTimeout().size() > 0) {
  104 + time = String.valueOf(this.getListTimeout().get(0).getNet());
  105 + if (!time.matches("^\\d+$")) {
  106 + time = "0";
  107 + }
  108 + }
  109 + /////////////////////////////////////////////////////
  110 + AppLog.d("####### TABLE TIMEOUT #######");
  111 + for (Timeout item : this.getListTimeout()) {
  112 + AppLog.d("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  113 +// System.out.println("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  114 + }
  115 + AppLog.d("############# END #############");
  116 + /////////////////////////////////////////////////////
  117 + return time;
  118 + }
  119 +
  120 + public void setTimeout(String name, String timeout, Date now)
  121 + {
  122 + String inputTimeStamp = Global.inputTimeStamp;
  123 + for (Timeout item : this.getListTimeout()) {
  124 + if (inputTimeStamp == null) {
  125 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  126 + item.setNet(second);
  127 + } else {
  128 + if (!item.getInputTimeStamp().equals(inputTimeStamp)) {
  129 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  130 + item.setNet(second);
  131 + } else {
  132 + item.setDate(now);
  133 + }
  134 + }
  135 + }
  136 + Timeout state = new Timeout();
  137 + state.setName(name);
  138 + state.setInputTimeStamp(inputTimeStamp);
  139 + state.setDate(now);
  140 + state.setTimeout(Integer.parseInt(timeout));
  141 + state.setNet(Integer.parseInt(timeout));
  142 + this.getListTimeout().add(state);
  143 + Collections.sort(this.getListTimeout(), new Comparator<Timeout>(){
  144 + public int compare(Timeout p1, Timeout p2) {
  145 + return Integer.valueOf(p1.getNet()) .compareTo(Integer.valueOf(p2.getNet()));
  146 + }
  147 + });
  148 + /////////////////////////////////////////////////////
  149 + AppLog.d("####### TABLE TIMEOUT #######");
  150 + for (Timeout item : this.getListTimeout()) {
  151 + AppLog.d("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  152 + //System.out.println("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  153 + }
  154 + AppLog.d("############# END #############");
  155 + /////////////////////////////////////////////////////
  156 + }
  157 +
  158 + public String getCalTime()
  159 + {
  160 + Date now = this.getNow();
  161 + for (Timeout item : this.getListTimeout()) {
  162 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  163 + item.setNet(second);
  164 + }
  165 + Collections.sort(this.getListTimeout(), new Comparator<Timeout>(){
  166 + public int compare(Timeout p1, Timeout p2) {
  167 + return Integer.valueOf(p1.getNet()).compareTo(Integer.valueOf(p2.getNet()));
  168 + }
  169 + });
  170 + String time = null;
  171 + int second = 0;
  172 + if (this.getListTimeout().size() > 0) {
  173 + second = this.getListTimeout().get(0).getNet();
  174 + }
  175 + if (second > 0) {
  176 + time = "" + second;
  177 + }
  178 + return time;
  179 + }
  180 +
  181 + public String getTime()
  182 + {
  183 + String time = null;
  184 + int second = 0;
  185 + if (this.getListTimeout().size() > 0) {
  186 + second = this.getListTimeout().get(0).getNet();
  187 + }
  188 + if (second > 0) {
  189 + time = "" + second;
  190 + }
  191 + return time;
  192 + }
  193 +
  194 + public Timeout getInsTime()
  195 + {
  196 + Date now = this.getNow();
  197 + for (Timeout item : this.getListTimeout()) {
  198 + int second = item.getTimeout() - this.diffDate(item.getDate(), now);
  199 + item.setNet(second);
  200 + }
  201 + Collections.sort(this.getListTimeout(), new Comparator<Timeout>(){
  202 + public int compare(Timeout p1, Timeout p2) {
  203 + return Integer.valueOf(p1.getNet()).compareTo(Integer.valueOf(p2.getNet()));
  204 + }
  205 + });
  206 + Timeout ins = null;
  207 + if (this.getListTimeout().size() > 0) {
  208 + ins = this.getListTimeout().get(0);
  209 + }
  210 + return ins;
  211 + }
  212 +
  213 + public List<String> getState()
  214 + {
  215 + List<String> list = this.getState(true);
  216 + return list;
  217 + }
  218 +
  219 + public List<String> getState(boolean isSet)
  220 + {
  221 + Log.dev("####### TABLE TIMEOUT(OLD) #######");
  222 + for (Timeout item : this.getListTimeout()) {
  223 + Log.dev("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  224 +// System.out.println("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  225 + }
  226 + Log.dev("############# END #############");
  227 + Collections.sort(this.getListTimeout(), new Comparator<Timeout>(){
  228 + public int compare(Timeout p1, Timeout p2) {
  229 + return Integer.valueOf(p1.getNet()).compareTo(Integer.valueOf(p2.getNet()));
  230 + }
  231 + });
  232 + int second = 0;
  233 + List<String> list = new ArrayList<String>();
  234 + if (this.getListTimeout().size() > 0) {
  235 + second = this.getListTimeout().get(0).getNet();
  236 + }
  237 + List<Timeout> tmp = new ArrayList<Timeout>();
  238 + for (Timeout item : this.getListTimeout()) {
  239 + if (item.getNet() == second) {
  240 + tmp.add(item);
  241 + list.add(item.getName());
  242 + }
  243 + }
  244 + for (Timeout timeout : tmp) {
  245 + this.getListTimeout().remove(timeout);
  246 + }
  247 + if (isSet) {
  248 + this.getEc02Instance().getAFInstance().setListTimeout(this.getListTimeout());
  249 + }
  250 + Log.dev("####### TABLE TIMEOUT(NEW) #######");
  251 + for (Timeout item : this.getListTimeout()) {
  252 + Log.dev("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  253 +// System.out.println("NAME :" + item.getName() + " DATE :" + item.getDate() + " TIME :" + item.getTimeout() + " NET :" + item.getNet());
  254 + }
  255 + Log.dev("############# END #############");
  256 + return list;
  257 + }
  258 +
  259 + public ArrayList<Timeout> getListTimeout() {
  260 + return listTimeout;
  261 + }
  262 +
  263 + public void setListTimeout(ArrayList<Timeout> listTimeout) {
  264 + this.listTimeout = listTimeout;
  265 + }
  266 +
  267 + public EC02Instance getEc02Instance() {
  268 + return ec02Instance;
  269 + }
  270 +
  271 + public void setEc02Instance(EC02Instance ec02Instance) {
  272 + this.ec02Instance = ec02Instance;
  273 + }
  274 +}
... ...
src/th/co/ais/ssbsrfc/instance/MenuTemplateIns.java 0 → 100644
... ... @@ -0,0 +1,148 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.LinkedList;
  5 +
  6 +public class MenuTemplateIns {
  7 + private String currentPath;
  8 + private String xml;
  9 + private String currentPromptId;
  10 + private String currentOrderId;
  11 + private String currentAPIId;
  12 + private int type;
  13 + private String redirectAddress = "";
  14 + private String senderName;
  15 + private boolean isSendResponse = false;
  16 +
  17 + public String getCurrentPath() {
  18 + return currentPath;
  19 + }
  20 + public void setCurrentPath(String currentPath) {
  21 + this.currentPath = currentPath;
  22 + }
  23 + public String getXml() {
  24 + return xml;
  25 + }
  26 + public void setXml(String xml) {
  27 + this.xml = xml;
  28 + }
  29 + public int getType() {
  30 + return type;
  31 + }
  32 + public void setType(int type) {
  33 + this.type = type;
  34 + }
  35 + public String getCurrentPromptId() {
  36 + return currentPromptId;
  37 + }
  38 + public void setCurrentPromptId(String currentPromptId) {
  39 + this.currentPromptId = currentPromptId;
  40 + }
  41 + public String getCurrentOrderId() {
  42 + return currentOrderId;
  43 + }
  44 + public void setCurrentOrderId(String currentOrderId) {
  45 + this.currentOrderId = currentOrderId;
  46 + }
  47 + public String getCurrentAPIId() {
  48 + return currentAPIId;
  49 + }
  50 + public void setCurrentAPIId(String currentAPIId) {
  51 + this.currentAPIId = currentAPIId;
  52 + }
  53 + public String getRedirectAddress() {
  54 + return redirectAddress;
  55 + }
  56 + public void setRedirectAddress(String redirectAddress) {
  57 + this.redirectAddress = redirectAddress;
  58 + }
  59 + public String getSenderName() {
  60 + return senderName;
  61 + }
  62 + public void setSenderName(String senderName) {
  63 + this.senderName = senderName;
  64 + }
  65 +
  66 + // data
  67 + private HashMap<String, String> mapXML = null;
  68 + private LinkedList<String> linkedlistXPath = null;
  69 + public HashMap<String, String> getMapXML() {
  70 + if (mapXML == null) {
  71 + mapXML = new HashMap<String, String>();
  72 + }
  73 + return mapXML;
  74 + }
  75 + public void setMapXML(HashMap<String, String> mapXML) {
  76 + this.mapXML = mapXML;
  77 + }
  78 + public LinkedList<String> getLinkedlistXPath() {
  79 + return linkedlistXPath;
  80 + }
  81 + public void setLinkedlistXPath(LinkedList<String> linkedlistXPath) {
  82 + this.linkedlistXPath = linkedlistXPath;
  83 + }
  84 + public void pushXPath(String xpath)
  85 + {
  86 + if (this.linkedlistXPath == null) {
  87 + this.linkedlistXPath = new LinkedList<String>();
  88 + }
  89 + this.linkedlistXPath.add(xpath);
  90 + }
  91 + public String popXPath()
  92 + {
  93 + String xpath = null;
  94 + if (this.linkedlistXPath != null && this.linkedlistXPath.size() != 0) {
  95 + xpath = this.linkedlistXPath.getLast();
  96 + this.linkedlistXPath.removeLast();
  97 + }
  98 +
  99 + return xpath;
  100 + }
  101 + public boolean isSendResponse() {
  102 + return isSendResponse;
  103 + }
  104 + public void setSendResponse(boolean isSendResponse) {
  105 + if (!this.isSendResponse) {
  106 + this.isSendResponse = isSendResponse;
  107 + }
  108 + }
  109 +
  110 + // Prompt
  111 + private PromptTemplateIns promptIns;
  112 +
  113 + public PromptTemplateIns getPromptIns() {
  114 + if(promptIns == null) {
  115 + this.promptIns = new PromptTemplateIns();
  116 + }
  117 + return promptIns;
  118 + }
  119 + public void setPromptIns(PromptTemplateIns promptIns) {
  120 + this.promptIns = promptIns;
  121 + }
  122 +
  123 + // RRR
  124 + private RRRIns rrrIns;
  125 +
  126 + public RRRIns getRrrIns() {
  127 + if(rrrIns == null) {
  128 + this.rrrIns = new RRRIns();
  129 + }
  130 + return rrrIns;
  131 + }
  132 + public void setRrrIns(RRRIns rrrIns) {
  133 + this.rrrIns = rrrIns;
  134 + }
  135 +
  136 + // OTP Response
  137 + private OTPResIns otpIns;
  138 +
  139 + public OTPResIns getOtpIns() {
  140 + if(otpIns == null) {
  141 + this.otpIns = new OTPResIns();
  142 + }
  143 + return otpIns;
  144 + }
  145 + public void setOtpIns(OTPResIns otpIns) {
  146 + this.otpIns = otpIns;
  147 + }
  148 +}
... ...
src/th/co/ais/ssbsrfc/instance/OTPResIns.java 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class OTPResIns {
  4 +
  5 + private String xml;
  6 + private String resultCode;
  7 + private String errorMessage;
  8 +
  9 + public String getXml() {
  10 + return xml;
  11 + }
  12 + public void setXml(String xml) {
  13 + this.xml = xml;
  14 + }
  15 + public String getResultCode() {
  16 + return resultCode;
  17 + }
  18 + public void setResultCode(String resultCode) {
  19 + this.resultCode = resultCode;
  20 + }
  21 + public String getErrorMessage() {
  22 + return errorMessage;
  23 + }
  24 + public void setErrorMessage(String errorMessage) {
  25 + this.errorMessage = errorMessage;
  26 + }
  27 +}
... ...
src/th/co/ais/ssbsrfc/instance/OwnershipInfo.java 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class OwnershipInfo {
  6 +
  7 + private String BEID;
  8 + private String BRID;
  9 +
  10 + @XmlElement(name="BEID",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  11 + public String getBEID() {
  12 + return BEID;
  13 + }
  14 + public void setBEID(String bEID) {
  15 + BEID = bEID;
  16 + }
  17 + @XmlElement(name="BRID",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  18 + public String getBRID() {
  19 + return BRID;
  20 + }
  21 + public void setBRID(String bRID) {
  22 + BRID = bRID;
  23 + }
  24 +
  25 +}
... ...
src/th/co/ais/ssbsrfc/instance/PromptTemplateIns.java 0 → 100644
... ... @@ -0,0 +1,81 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class PromptTemplateIns {
  4 + private String id;
  5 + private String retrySubmitSM;
  6 + private String timeoutSubmitSM;
  7 + private String requireDeliveryReport;
  8 + private String timeoutDeliveryReport;
  9 + private String requireDeliverSM;
  10 + private String timeoutDeliverSM;
  11 + private String retry;
  12 + private String rrrResult = "1";
  13 + private String rrrDiagnostic = "SRFC Send Prompt <id> Fail";
  14 +
  15 + public void setPromptSuccess() {
  16 + this.rrrResult = "0";
  17 + this.rrrDiagnostic = "SRFC Send Prompt " + this.id + " Success";
  18 + }
  19 +
  20 + public String getId() {
  21 + return id;
  22 + }
  23 + public void setId(String id) {
  24 + this.id = id;
  25 + this.rrrDiagnostic = this.rrrDiagnostic.replace("<id>", id);
  26 + }
  27 + public String getRetrySubmitSM() {
  28 + return retrySubmitSM;
  29 + }
  30 + public void setRetrySubmitSM(String retrySubmitSM) {
  31 + this.retrySubmitSM = retrySubmitSM;
  32 + }
  33 + public String getTimeoutSubmitSM() {
  34 + return timeoutSubmitSM;
  35 + }
  36 + public void setTimeoutSubmitSM(String timeoutSubmitSM) {
  37 + this.timeoutSubmitSM = timeoutSubmitSM;
  38 + }
  39 + public String getRequireDeliveryReport() {
  40 + return requireDeliveryReport;
  41 + }
  42 + public void setRequireDeliveryReport(String requireDeliveryReport) {
  43 + this.requireDeliveryReport = requireDeliveryReport;
  44 + }
  45 + public String getTimeoutDeliveryReport() {
  46 + return timeoutDeliveryReport;
  47 + }
  48 + public void setTimeoutDeliveryReport(String timeoutDeliveryReport) {
  49 + this.timeoutDeliveryReport = timeoutDeliveryReport;
  50 + }
  51 + public String getRequireDeliverSM() {
  52 + return requireDeliverSM;
  53 + }
  54 + public void setRequireDeliverSM(String requireDeliverSM) {
  55 + this.requireDeliverSM = requireDeliverSM;
  56 + }
  57 + public String getTimeoutDeliverSM() {
  58 + return timeoutDeliverSM;
  59 + }
  60 + public void setTimeoutDeliverSM(String timeoutDeliverSM) {
  61 + this.timeoutDeliverSM = timeoutDeliverSM;
  62 + }
  63 + public String getRetry() {
  64 + return retry;
  65 + }
  66 + public void setRetry(String retry) {
  67 + this.retry = retry;
  68 + }
  69 + public String getRrrResult() {
  70 + return rrrResult;
  71 + }
  72 + public void setRrrResult(String rrrResult) {
  73 + this.rrrResult = rrrResult;
  74 + }
  75 + public String getRrrDiagnostic() {
  76 + return rrrDiagnostic;
  77 + }
  78 + public void setRrrDiagnostic(String rrrDiagnostic) {
  79 + this.rrrDiagnostic = rrrDiagnostic;
  80 + }
  81 +}
... ...
src/th/co/ais/ssbsrfc/instance/RRRIns.java 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class RRRIns {
  4 +
  5 + private String xml;
  6 + private String result;
  7 + private String diagnostic;
  8 + private int retryMax = 0;
  9 + private int retryCount = 0;
  10 +
  11 + public String getXml() {
  12 + return xml;
  13 + }
  14 + public void setXml(String xml) {
  15 + this.xml = xml;
  16 + }
  17 + public String getResult() {
  18 + return result;
  19 + }
  20 + public void setResult(String result) {
  21 + this.result = result;
  22 + }
  23 + public String getDiagnostic() {
  24 + return diagnostic;
  25 + }
  26 + public void setDiagnostic(String diagnostic) {
  27 + this.diagnostic = diagnostic;
  28 + }
  29 + public int getRetryMax() {
  30 + return retryMax;
  31 + }
  32 + public void setRetryMax(int retryMax) {
  33 + this.retryMax = retryMax;
  34 + }
  35 + public int getRetryCount() {
  36 + return retryCount;
  37 + }
  38 + public void setRetryCount(int retryCount) {
  39 + this.retryCount = retryCount;
  40 + }
  41 +}
... ...
src/th/co/ais/ssbsrfc/instance/RequestHeader.java 0 → 100644
... ... @@ -0,0 +1,60 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +import javax.xml.bind.annotation.XmlRootElement;
  5 +import javax.xml.bind.annotation.XmlType;
  6 +
  7 +
  8 +@XmlType (propOrder={"version","businessCode","messageSeq","ownershipInfo","accessSecurity","accessMode"})
  9 +public class RequestHeader {
  10 +
  11 + private String Version;
  12 + private String BusinessCode;
  13 + private String MessageSeq;
  14 + private OwnershipInfo ownershipInfo;
  15 + private AccessSecurity accessSecurity;
  16 + private String AccessMode;
  17 +
  18 + @XmlElement(name="Version",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  19 + public String getVersion() {
  20 + return Version;
  21 + }
  22 + public void setVersion(String version) {
  23 + Version = version;
  24 + }
  25 + @XmlElement(name="AccessSecurity",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  26 + public AccessSecurity getAccessSecurity() {
  27 + return accessSecurity;
  28 + }
  29 + public void setAccessSecurity(AccessSecurity accessSecurity) {
  30 + this.accessSecurity = accessSecurity;
  31 + }
  32 + @XmlElement(name="AccessMode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  33 + public String getAccessMode() {
  34 + return AccessMode;
  35 + }
  36 + public void setAccessMode(String accessMode) {
  37 + AccessMode = accessMode;
  38 + }
  39 + @XmlElement(name="BusinessCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  40 + public String getBusinessCode() {
  41 + return BusinessCode;
  42 + }
  43 + public void setBusinessCode(String businessCode) {
  44 + BusinessCode = businessCode;
  45 + }
  46 + @XmlElement(name="MessageSeq",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  47 + public String getMessageSeq() {
  48 + return MessageSeq;
  49 + }
  50 + public void setMessageSeq(String messageSeq) {
  51 + MessageSeq = messageSeq;
  52 + }
  53 + @XmlElement(name="OwnershipInfo",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  54 + public OwnershipInfo getOwnershipInfo() {
  55 + return ownershipInfo;
  56 + }
  57 + public void setOwnershipInfo(OwnershipInfo ownershipInfo) {
  58 + this.ownershipInfo = ownershipInfo;
  59 + }
  60 +}
... ...
src/th/co/ais/ssbsrfc/instance/ResIns.java 0 → 100644
... ... @@ -0,0 +1,79 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import th.co.ais.ssbsrfc.message.MessageParser;
  4 +import th.co.ais.ssbsrfc.utils.Global;
  5 +
  6 +import com.google.gson.Gson;
  7 +
  8 +import ec02.utils.AppLog;
  9 +
  10 +public class ResIns
  11 +{
  12 + private String method = null;
  13 + private String resultCode = "";
  14 + private String resultDescription = "";
  15 + private String command = null;
  16 +
  17 + public ResIns () {}
  18 +
  19 + public ResIns(String resultCode, String resultDescription) {
  20 + super();
  21 + this.resultCode = resultCode;
  22 + this.resultDescription = resultDescription;
  23 + }
  24 +
  25 + public ResIns (String code, String desc, String cmd) {
  26 + this.resultCode = code;
  27 + this.resultDescription = desc;
  28 + this.command = cmd;
  29 + }
  30 +
  31 + public ResIns(String strJson) {
  32 + try {
  33 + Gson gson = new Gson();
  34 + ResIns ins = gson.fromJson(strJson, ResIns.class);
  35 + this.resultCode = ins.getResultCode();
  36 + this.resultDescription = ins.getResultDescription();
  37 + if (ins.getCommand() != null) {
  38 + this.command = ins.getCommand();
  39 + }
  40 + } catch (Exception e) {
  41 + AppLog.e("## EXCEPTION :" + e.getMessage());
  42 + }
  43 + }
  44 +
  45 + @Override
  46 + public String toString() {
  47 + return Global.unescapePrintString(MessageParser.toJson(this));
  48 + }
  49 +
  50 + public String getResultCode() {
  51 + return resultCode;
  52 + }
  53 + public void setResultCode(String resultCode) {
  54 + this.resultCode = resultCode;
  55 + }
  56 + public String getResultDescription() {
  57 + return resultDescription;
  58 + }
  59 + public void setResultDescription(String resultDescription) {
  60 + this.resultDescription = resultDescription;
  61 + }
  62 +
  63 + public String getCommand() {
  64 + return command;
  65 + }
  66 +
  67 + public void setCommand(String command) {
  68 + this.command = command;
  69 + }
  70 +
  71 + public String getMethod() {
  72 + return method;
  73 + }
  74 +
  75 + public void setMethod(String method) {
  76 + this.method = method;
  77 + }
  78 +
  79 +}
... ...
src/th/co/ais/ssbsrfc/instance/Response.java 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class Response {
  4 +
  5 + private String orig = "";
  6 + private String invoke = "";
  7 +
  8 + public Response () {}
  9 +
  10 + public Response (String orig, String invoke) {
  11 + this.orig = orig;
  12 + this.invoke = invoke;
  13 + }
  14 +
  15 + public String getOrig() {
  16 + return orig;
  17 + }
  18 +
  19 + public void setOrig(String orig) {
  20 + this.orig = orig;
  21 + }
  22 +
  23 + public String getInvoke() {
  24 + return invoke;
  25 + }
  26 +
  27 + public void setInvoke(String invoke) {
  28 + this.invoke = invoke;
  29 + }
  30 +}
... ...
src/th/co/ais/ssbsrfc/instance/ResultHeader.java 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class ResultHeader {
  6 +
  7 + private String Version;
  8 + private String ResultCode;
  9 + private String MsgLanguageCode;
  10 + private String ResultDesc;
  11 +
  12 + @XmlElement(name="Version",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  13 + public String getVersion() {
  14 + return Version;
  15 + }
  16 +
  17 + public void setVersion(String version) {
  18 + Version = version;
  19 + }
  20 +
  21 + @XmlElement(name="ResultCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  22 + public String getResultCode() {
  23 + return ResultCode;
  24 + }
  25 +
  26 + public void setResultCode(String resultCode) {
  27 + ResultCode = resultCode;
  28 + }
  29 +
  30 + @XmlElement(name="MsgLanguageCode",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  31 + public String getMsgLanguageCode() {
  32 + return MsgLanguageCode;
  33 + }
  34 +
  35 + public void setMsgLanguageCode(String msgLanguageCode) {
  36 + MsgLanguageCode = msgLanguageCode;
  37 + }
  38 +
  39 + @XmlElement(name="ResultDesc",namespace="http://www.huawei.com/bme/cbsinterface/cbscommon")
  40 + public String getResultDesc() {
  41 + return ResultDesc;
  42 + }
  43 +
  44 + public void setResultDesc(String resultDesc) {
  45 + ResultDesc = resultDesc;
  46 + }
  47 +
  48 +}
... ...
src/th/co/ais/ssbsrfc/instance/RetryIns.java 0 → 100644
... ... @@ -0,0 +1,54 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import ec02.utils.AppLog;
  4 +
  5 +public class RetryIns {
  6 + private int countRetry = 0;
  7 + private int max = 0;
  8 +// private EquinoxRawData eqx = null;
  9 + private String url = null;
  10 +
  11 + public RetryIns(int max, /*EquinoxRawData eqx,*/ String url) {
  12 + super();
  13 + this.max = max;
  14 + this.countRetry = 0;
  15 +// this.eqx = eqx;
  16 + this.url = url;
  17 + }
  18 + public boolean isRetry(EC02Instance ec02Instance, String key)
  19 + {
  20 + boolean isBool = false;
  21 + if (this.max > this.countRetry) {
  22 + this.countRetry++;
  23 + AppLog.d("## RETRY MESSAGE MAX:" + this.getMax() + " COUNT RETRY:" + this.getCountRetry());
  24 + isBool = true;
  25 + } else {
  26 + ec02Instance.getAFInstance().getDicRetry().remove(key);
  27 + }
  28 + return isBool;
  29 + }
  30 + public int getCountRetry() {
  31 + return countRetry;
  32 + }
  33 + public void setCountRetry(int countRetry) {
  34 + this.countRetry = countRetry;
  35 + }
  36 + public int getMax() {
  37 + return max;
  38 + }
  39 + public void setMax(int max) {
  40 + this.max = max;
  41 + }
  42 +// public EquinoxRawData getEqx() {
  43 +// return eqx;
  44 +// }
  45 +// public void setEqx(EquinoxRawData eqx) {
  46 +// this.eqx = eqx;
  47 +// }
  48 + public String getUrl() {
  49 + return url;
  50 + }
  51 + public void setUrl(String url) {
  52 + this.url = url;
  53 + }
  54 +}
... ...
src/th/co/ais/ssbsrfc/instance/SOAPNamespaceMapper.java 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
  4 +
  5 +
  6 +public class SOAPNamespaceMapper extends NamespacePrefixMapper {
  7 +
  8 + private static final String SOAPENV_PREFIX = "soapenv"; // DEFAULT NAMESPACE
  9 + private static final String SOAPENV_URI = "http://schemas.xmlsoap.org/soap/envelope/";
  10 +
  11 + private static final String CBS_PREFIX = "cbs";
  12 + private static final String CBS_URI = "http://www.huawei.com/bme/cbsinterface/cbscommon";
  13 +
  14 + private static final String ARS_PREFIX = "ars";
  15 + private static final String ARS_URI = "http://www.huawei.com/bme/cbsinterface/arservices";
  16 +
  17 + private static final String ARC_PREFIX = "arc";
  18 + private static final String ARC_URI = "http://cbs.huawei.com/ar/wsservice/arcommon";
  19 +
  20 +
  21 + @Override
  22 + public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
  23 + if(SOAPENV_URI.equals(namespaceUri)) {
  24 + return SOAPENV_PREFIX;
  25 + } else if(ARC_URI.equals(namespaceUri)) {
  26 + return ARC_PREFIX;
  27 + } else if(ARS_URI.equals(namespaceUri)) {
  28 + return ARS_PREFIX;
  29 + } else if(CBS_URI.equals(namespaceUri)) {
  30 + return CBS_PREFIX;
  31 + }
  32 + return suggestion;
  33 + }
  34 +
  35 +
  36 +}
... ...
src/th/co/ais/ssbsrfc/instance/Stat.java 0 → 100644
... ... @@ -0,0 +1,98 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import th.co.ais.ssbsrfc.config.Constant;
  4 +
  5 +public class Stat {
  6 +
  7 + private String currentSubState = null;
  8 + private int sendOrReceive;
  9 + private int responseOrRequest;
  10 + private int type;
  11 + private String message;
  12 + private String command = null;
  13 + private String name = null;
  14 +
  15 + public Stat(String currentSubState, int sendOrReceive, int responseOrRequest) {
  16 + super();
  17 + this.currentSubState = currentSubState;
  18 + this.sendOrReceive = sendOrReceive;
  19 + this.responseOrRequest = responseOrRequest;
  20 + this.type = Constant.TYPE_SUCCESS;
  21 + this.message = "";
  22 + }
  23 +
  24 + public Stat(String currentSubState, int sendOrReceive,
  25 + int responseOrRequest, int type, String message) {
  26 + super();
  27 + this.currentSubState = currentSubState;
  28 + this.sendOrReceive = sendOrReceive;
  29 + this.responseOrRequest = responseOrRequest;
  30 + this.type = type;
  31 + this.message = message;
  32 + }
  33 +
  34 + public Stat(String currentSubState, int sendOrReceive,
  35 + int responseOrRequest, int type, String message, String command) {
  36 + super();
  37 + this.currentSubState = currentSubState;
  38 + this.sendOrReceive = sendOrReceive;
  39 + this.responseOrRequest = responseOrRequest;
  40 + this.type = type;
  41 + this.message = message;
  42 + this.command = command;
  43 + }
  44 +
  45 + public Stat(String name) {
  46 + super();
  47 + this.name = name;
  48 + }
  49 +
  50 + public String getName() {
  51 + return name;
  52 + }
  53 + public void setName(String name) {
  54 + this.name = name;
  55 + }
  56 + public String getCurrentSubState() {
  57 + return currentSubState;
  58 + }
  59 + public void setCurrentSubState(String currentSubState) {
  60 + this.currentSubState = currentSubState;
  61 + }
  62 + public int getSendOrReceive() {
  63 + return sendOrReceive;
  64 + }
  65 + public void setSendOrReceive(int sendOrReceive) {
  66 + this.sendOrReceive = sendOrReceive;
  67 + }
  68 + public int getResponseOrRequest() {
  69 + return responseOrRequest;
  70 + }
  71 + public void setResponseOrRequest(int responseOrRequest) {
  72 + this.responseOrRequest = responseOrRequest;
  73 + }
  74 +
  75 + public int getType() {
  76 + return type;
  77 + }
  78 +
  79 + public void setType(int type) {
  80 + this.type = type;
  81 + }
  82 +
  83 + public String getMessage() {
  84 + return message;
  85 + }
  86 +
  87 + public void setMessage(String message) {
  88 + this.message = message;
  89 + }
  90 +
  91 + public String getCommand() {
  92 + return command;
  93 + }
  94 +
  95 + public void setCommand(String command) {
  96 + this.command = command;
  97 + }
  98 +}
... ...
src/th/co/ais/ssbsrfc/instance/SubAccessCode.java 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import javax.xml.bind.annotation.XmlElement;
  4 +
  5 +public class SubAccessCode {
  6 +
  7 + private String PrimaryIdentity;
  8 +
  9 + @XmlElement(name="SubAccessCode",namespace="http://cbs.huawei.com/ar/wsservice/arcommon")
  10 + public String getPrimaryIdentity() {
  11 + return PrimaryIdentity;
  12 + }
  13 +
  14 + public void setPrimaryIdentity(String primaryIdentity) {
  15 + PrimaryIdentity = primaryIdentity;
  16 + }
  17 +
  18 +}
... ...
src/th/co/ais/ssbsrfc/instance/Summary.java 0 → 100644
... ... @@ -0,0 +1,77 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +public class Summary {
  4 + private String destinationNodeName = "null";
  5 + private String destinationNodeIP = "null";
  6 + private String destinationNodeCommand = "null";
  7 + private String destinationNodeResultCode = "null";
  8 + private String destinationNodeResultDescription = "null";
  9 +
  10 + public Summary() {
  11 + super();
  12 + }
  13 + public Summary(String destinationNodeResultCode,
  14 + String destinationNodeResultDescription) {
  15 + super();
  16 + this.destinationNodeResultCode = destinationNodeResultCode;
  17 + this.destinationNodeResultDescription = destinationNodeResultDescription;
  18 + }
  19 + public Summary(String destinationNodeName, String destinationNodeCommand,
  20 + String destinationNodeResultCode,
  21 + String destinationNodeResultDescription) {
  22 + super();
  23 + this.destinationNodeName = destinationNodeName;
  24 + this.destinationNodeCommand = destinationNodeCommand;
  25 + this.destinationNodeResultCode = destinationNodeResultCode;
  26 + this.destinationNodeResultDescription = destinationNodeResultDescription;
  27 + }
  28 + public Summary(String destinationNodeName, String destinationNodeIP,
  29 + String destinationNodeCommand, String destinationNodeResultCode,
  30 + String destinationNodeResultDescription) {
  31 + super();
  32 + this.destinationNodeName = destinationNodeName;
  33 + this.destinationNodeIP = destinationNodeIP;
  34 + this.destinationNodeCommand = destinationNodeCommand;
  35 + this.destinationNodeResultCode = destinationNodeResultCode;
  36 + this.destinationNodeResultDescription = destinationNodeResultDescription;
  37 + }
  38 + public String getDestinationNodeName() {
  39 + return destinationNodeName;
  40 + }
  41 + public void setDestinationNodeName(String destinationNodeName) {
  42 + this.destinationNodeName = destinationNodeName;
  43 + }
  44 + public String getDestinationNodeIP() {
  45 + return destinationNodeIP;
  46 + }
  47 + public void setDestinationNodeIP(String destinationNodeIP) {
  48 + this.destinationNodeIP = destinationNodeIP;
  49 + }
  50 + public String getDestinationNodeCommand() {
  51 + return destinationNodeCommand;
  52 + }
  53 + public void setDestinationNodeCommand(String destinationNodeCommand) {
  54 + this.destinationNodeCommand = destinationNodeCommand;
  55 + }
  56 + public String getDestinationNodeResultCode() {
  57 + return destinationNodeResultCode;
  58 + }
  59 + public void setDestinationNodeResultCode(String destinationNodeResultCode) {
  60 + if (this.destinationNodeResultCode == null) {
  61 + this.destinationNodeResultCode = destinationNodeResultCode;
  62 + } else {
  63 + this.destinationNodeResultCode += "," + destinationNodeResultCode;
  64 + }
  65 + }
  66 + public String getDestinationNodeResultDescription() {
  67 + return destinationNodeResultDescription;
  68 + }
  69 + public void setDestinationNodeResultDescription(
  70 + String destinationNodeResultDescription) {
  71 + if (this.destinationNodeResultDescription == null) {
  72 + this.destinationNodeResultDescription = destinationNodeResultDescription;
  73 + } else {
  74 + this.destinationNodeResultDescription += "," + destinationNodeResultDescription;
  75 + }
  76 + }
  77 +}
... ...
src/th/co/ais/ssbsrfc/instance/Timeout.java 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Timeout {
  6 +
  7 + private String name = "";
  8 + private String inputTimeStamp = null;
  9 + private Date date = null;
  10 + private int timeout = 0;
  11 + private int net = 0;
  12 + private int flow = 0;
  13 +
  14 + @Override
  15 + public String toString() {
  16 + return "## PARAMETERS: {\tname=" + name + ", \tdate=" + date
  17 + + ", \ttimeout=" + timeout + ", \tnet=" + net
  18 + + ", \tflow=" + flow + "}";
  19 + }
  20 + public String getName() {
  21 + return name;
  22 + }
  23 + public void setName(String name) {
  24 + this.name = name;
  25 + }
  26 + public Date getDate() {
  27 + return date;
  28 + }
  29 + public void setDate(Date date) {
  30 + this.date = date;
  31 + }
  32 + public int getTimeout() {
  33 + return timeout;
  34 + }
  35 + public void setTimeout(int timeout) {
  36 + this.timeout = timeout;
  37 + }
  38 + public int getNet() {
  39 + return net;
  40 + }
  41 + public void setNet(int net) {
  42 + this.net = net;
  43 + }
  44 + public int getFlow() {
  45 + return flow;
  46 + }
  47 + public void setFlow(int flow) {
  48 + this.flow = flow;
  49 + }
  50 + public String getInputTimeStamp() {
  51 + return inputTimeStamp;
  52 + }
  53 + public void setInputTimeStamp(String inputTimeStamp) {
  54 + this.inputTimeStamp = inputTimeStamp;
  55 + }
  56 +}
... ...
src/th/co/ais/ssbsrfc/instance/TimeoutIns.java 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +package th.co.ais.ssbsrfc.instance;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import ec02.af.data.EquinoxRawData;
  7 +
  8 +public class TimeoutIns {
  9 +
  10 + private List<EquinoxRawData> equinoxRawDataList = new ArrayList<EquinoxRawData>();
  11 + private String eqxState = "";
  12 +
  13 + public List<EquinoxRawData> getEquinoxRawDataList() {
  14 + return equinoxRawDataList;
  15 + }
  16 + public void setEquinoxRawDataList(List<EquinoxRawData> equinoxRawDataList) {
  17 + this.equinoxRawDataList = equinoxRawDataList;
  18 + }
  19 + public String getEqxState() {
  20 + return eqxState;
  21 + }
  22 + public void setEqxState(String eqxState) {
  23 + this.eqxState = eqxState;
  24 + }
  25 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/AFEvent.java 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +public interface AFEvent {
  4 + public String Unknown ="Unknown";
  5 + public String ERROR = "EQUINOX_EVENT_ERROR";
  6 + public String REJECT = "EQUINOX_EVENT_REJECT";
  7 + public String ABORT = "EQUINOX_EVENT_ABORT";
  8 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/AFState.java 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +public interface AFState {
  4 + public String IDLE = "IDLE";
  5 + public String W_ACTIVE = "W_ACTIVE";
  6 + public String W_E11_TIMEOUT = "W_E11_TIMEOUT";
  7 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/AFSubState.java 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import ec02.af.abstracts.AbstractAF;
  6 +import ec02.af.data.EquinoxRawData;
  7 +import ec02.af.interfaces.IAFState;
  8 +
  9 +public class AFSubState implements IAFState {
  10 +
  11 + @Override
  12 + public String doAction(AbstractAF arg0, Object arg1,
  13 + ArrayList<EquinoxRawData> arg2) {
  14 + // TODO Auto-generated method stub
  15 + return null;
  16 + }
  17 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/AbstractAFSubStateManager.java 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +import java.util.List;
  4 +
  5 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  6 +import ec02.af.abstracts.AbstractAF;
  7 +import ec02.af.data.EquinoxRawData;
  8 +
  9 +public class AbstractAFSubStateManager implements IAFSubState {
  10 +
  11 + public IAFSubState subStateManager;
  12 +
  13 + @Override
  14 + public List<EquinoxRawData> doActionSubState(AbstractAF abstractAF,
  15 + EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
  16 + return this.subStateManager.doActionSubState(abstractAF, ec02Instance, equinoxRawData);
  17 + }
  18 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/Atomic.java 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +public interface Atomic {
  4 + public String command_get = "get";
  5 + public String command_increase = "increase";
  6 + public String command_clear = "clear";
  7 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/EQXMsg.java 0 → 100644
... ... @@ -0,0 +1,70 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +public interface EQXMsg {
  4 + public String ORIG = "orig";
  5 +
  6 + public String INVOKE = "invoke";
  7 + public String TYPE = "type";
  8 + public String CTYPE = "ctype";
  9 + public String NAME = "name";
  10 + public String OID = "oid";
  11 + public String VAL = "val";
  12 + public String ECODE = "ecode";
  13 + public String URL = "url";
  14 + public String METHOD = "method";
  15 +
  16 + public String OID_CODE = "";
  17 +
  18 + //message
  19 + public String EMPTY = "";
  20 +
  21 + //type
  22 + public String REQUEST = "request";
  23 + public String RESPONSE = "response";
  24 + public String NOREPLY = "noreply";
  25 +
  26 + //ctype
  27 + public String UNKNOWN = "unknown";
  28 +
  29 + //method
  30 + public String POST = "POST";
  31 + public String GET = "GET";
  32 + public String PUT = "PUT";
  33 + public String DELETE = "DELETE";
  34 +
  35 + //http
  36 + public String HTTP = "HTTP";
  37 + public String TEXTPLAIN = "text/plain";
  38 + public String TEXTXML = "text/xml";
  39 + public String TEXTHTML = "text/html";
  40 + public String FILECONTROL = "FILECONTROL";
  41 + public String APPSOAPXML = "application/soap-xml";
  42 + public String SPECIALIZEDRESOURCE = "Specialized-Resource";
  43 + public String RESOURCEREPORT = "Resource-Report";
  44 + public String ONETIMEPASSWORD = "One-Time-Password";
  45 + public String CONFIRMONETIMEPASSWORD = "Confirm-One-Time-Password";
  46 +
  47 + //ldap
  48 + public String LDAP = "LDAP";
  49 + public String SEARCH = "search";
  50 + public String MODIFY = "modify";
  51 +// public String DELETE = "delete";
  52 + public String EXTENDED = "extended";
  53 + public String EXECUTE = "execute";
  54 +
  55 + //smpp
  56 + public String SMPP = "SMPP";
  57 +
  58 + //diameter
  59 + public String DIAMETER = "DIAMETER";
  60 +
  61 + // type ES00
  62 + public int TYPE_START = 1;
  63 + public int TYPE_FINISH = 2;
  64 + public int TYPE_ERROR = 3;
  65 +
  66 + // state ES00
  67 + public int STATE_START = 1;
  68 + public int STATE_FINISH = 2;
  69 +
  70 +}
... ...
src/th/co/ais/ssbsrfc/interfaces/IAFSubState.java 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +package th.co.ais.ssbsrfc.interfaces;
  2 +
  3 +import java.util.List;
  4 +
  5 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  6 +import ec02.af.abstracts.AbstractAF;
  7 +import ec02.af.data.EquinoxRawData;
  8 +
  9 +public interface IAFSubState{
  10 + public List<EquinoxRawData> doActionSubState(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData);
  11 +}
... ...
src/th/co/ais/ssbsrfc/message/EC02Builder.java 0 → 100644
... ... @@ -0,0 +1,317 @@
  1 +package th.co.ais.ssbsrfc.message;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.config.Constant;
  6 +import th.co.ais.ssbsrfc.config.Invoke;
  7 +import th.co.ais.ssbsrfc.config.StateConfig;
  8 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  9 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  10 +import th.co.ais.ssbsrfc.instance.Response;
  11 +import th.co.ais.ssbsrfc.instance.Stat;
  12 +import th.co.ais.ssbsrfc.interfaces.Atomic;
  13 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  14 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  15 +import th.co.ais.ssbsrfc.utils.Global;
  16 +import th.co.ais.ssbsrfc.utils.Log;
  17 +import ais.mmt.sand.comlog.DetailsLogPrototype;
  18 +import ais.mmt.sand.comlog.bean.DataBean;
  19 +import ais.mmt.sand.comlog.bean.DataBean.TYPE;
  20 +import ais.mmt.sand.comlog.exception.CommonLogException;
  21 +import ec02.af.abstracts.AbstractAF;
  22 +import ec02.af.data.EquinoxRawData;
  23 +import ec02.af.data.KeyObject;
  24 +import ec02.utils.AppLog;
  25 +
  26 +public class EC02Builder {
  27 + private EC02Instance ec02Ins = null;
  28 + private AbstractAF abstractAF = null;
  29 + private EquinoxRawData eqxRawData =null;
  30 + private EC02MSGBuilder msgBuilder = null;
  31 +
  32 +
  33 + public void setEquinoxRawData(AbstractAF abstractAF, EC02Instance ec02Ins){
  34 + this.abstractAF = abstractAF;
  35 + this.ec02Ins = ec02Ins;
  36 + }
  37 + public void setEquinoxRawData(EquinoxRawData eqxRawData, AbstractAF abstractAF, EC02Instance ec02Ins){
  38 + this.eqxRawData = eqxRawData;
  39 + this.abstractAF = abstractAF;
  40 + this.ec02Ins = ec02Ins;
  41 + }
  42 +
  43 + public ArrayList<EquinoxRawData> getHTTPRequest(ArrayList<EQXRawInstance> eqxRawList){
  44 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  45 + String timeout = null;
  46 + for (int i = 0; i < eqxRawList.size(); i++) {
  47 + String type = eqxRawList.get(i).getType();
  48 + if (type == null) {
  49 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  50 + }
  51 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  52 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  53 +
  54 + timeout = eqxRawList.get(i).getTimeout();
  55 +
  56 + EquinoxRawData rowData = this.msgBuilder.getHttpMessage();
  57 + this.logDetailOutput(rowData, eqxRawList.get(i).getDataOutput(), eqxRawList.get(i).getNodeTo(), eqxRawList.get(i).getCommand());
  58 + eqxRawDataList.add(rowData);
  59 + }
  60 + if (timeout != null) {
  61 + this.ec02Ins.setTimeout(timeout);
  62 + }
  63 + this.ec02Ins.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " Send Total Armed Event"));
  64 + return eqxRawDataList;
  65 + }
  66 +
  67 + public EquinoxRawData getRequest(EQXRawInstance eqxRaw) {
  68 + String type = eqxRaw.getType();
  69 + if (type == null) {
  70 + eqxRaw.setType(EQXMsg.REQUEST);
  71 + }
  72 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  73 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  74 + String timeout = eqxRaw.getTimeout();
  75 + if (timeout != null) {
  76 + this.ec02Ins.setTimeout(timeout);
  77 + }
  78 + EquinoxRawData rowData = this.msgBuilder.getHttpMessage();
  79 + this.logDetailOutput(rowData, eqxRaw.getDataOutput(), eqxRaw.getNodeTo(), eqxRaw.getCommand());
  80 + return rowData;
  81 + }
  82 +
  83 + public EquinoxRawData getRequestJobTracking(EQXRawInstance eqxRaw) {
  84 + String type = eqxRaw.getType();
  85 + if (type == null) {
  86 + eqxRaw.setType(EQXMsg.REQUEST);
  87 + }
  88 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  89 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  90 + String timeout = eqxRaw.getTimeout();
  91 + if (timeout != null) {
  92 + this.ec02Ins.setTimeout(timeout);
  93 + }
  94 +
  95 + // set orig/invoke
  96 + String key = eqxRaw.getInvoke();
  97 + String orig = "";
  98 + String invoke = "";
  99 + if (this.eqxRawData != null) {
  100 + orig = this.eqxRawData.getRawDataAttribute(EQXMsg.ORIG);
  101 + invoke = this.eqxRawData.getInvoke();
  102 + } else {
  103 + orig = this.ec02Ins.getAFInstance().getOrig();
  104 + invoke = this.ec02Ins.getAFInstance().getInvoke();
  105 + }
  106 + if (!(new Invoke(key).eventType).equals(EQXMsg.UNKNOWN)) {
  107 + Response res = new Response (orig, invoke) ;
  108 + this.ec02Ins.getAFInstance().setListOrigKey(key, res);
  109 +// AppLog.d("## RESPONSE[MG]: " + orig + "/" + invoke);
  110 + }
  111 + EquinoxRawData rowData = this.msgBuilder.getHttpMessage();
  112 + this.logDetailOutput(rowData, eqxRaw.getDataOutput(), eqxRaw.getNodeTo(), eqxRaw.getCommand());
  113 + return rowData;
  114 + }
  115 +
  116 + public EquinoxRawData getHTTPResponse(EQXRawInstance eqxRaw){
  117 + eqxRaw.setType(EQXMsg.RESPONSE);
  118 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  119 + String invoke = (eqxRaw.getInvoke() == null) ? this.ec02Ins.getAFInstance().getInvoke() : eqxRaw.getInvoke();
  120 + if (invoke != null && !invoke.equals("")) {
  121 + this.msgBuilder.setInvoke(invoke);
  122 + }
  123 + EquinoxRawData rowData = this.msgBuilder.getHttpMessage();
  124 + this.logDetailOutput(rowData, eqxRaw.getDataOutput(), eqxRaw.getNodeTo(), eqxRaw.getCommand());
  125 + String subState = (eqxRaw.getSubState() == null) ? "" : eqxRaw.getSubState();
  126 + if (!subState.equals("")) {
  127 + rowData.getRawDataAttributes().put("subState", subState);
  128 + }
  129 + String timeout = eqxRaw.getTimeout();
  130 + if (timeout != null) {
  131 + this.ec02Ins.setTimeout(timeout);
  132 + }
  133 + return this.msgBuilder.getHttpMessage();
  134 + }
  135 +
  136 + /*public ArrayList<EquinoxRawData> getLDAPRequest(ArrayList<EQXRawInstance> eqxRawList){
  137 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  138 + for (int i = 0; i < eqxRawList.size(); i++) {
  139 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  140 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  141 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  142 + eqxRawDataList.add(this.msgBuilder.getLdapMessage());
  143 + }
  144 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("LDAP-timeout").get(0);
  145 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  146 + this.ec02Ins.setTimeout(timeout);
  147 +
  148 + return eqxRawDataList;
  149 + }
  150 +
  151 + public EquinoxRawData getLDAPResponse(EQXRawInstance eqxRaw){
  152 + eqxRaw.setType(EQXMsg.RESPONSE);
  153 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  154 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  155 + return this.msgBuilder.getLdapMessage();
  156 + }
  157 +
  158 + public ArrayList<EquinoxRawData> getSMPPRequest(ArrayList<EQXRawInstance> eqxRawList){
  159 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  160 + for (int i = 0; i < eqxRawList.size(); i++) {
  161 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  162 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  163 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  164 + eqxRawDataList.add(this.msgBuilder.getSMPPMessage());
  165 + }
  166 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("SMPP-timeout").get(0);
  167 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  168 + this.ec02Ins.setTimeout(timeout);
  169 +
  170 + return eqxRawDataList;
  171 + }
  172 +
  173 + public EquinoxRawData getSMPPResponse(EQXRawInstance eqxRaw){
  174 + eqxRaw.setType(EQXMsg.RESPONSE);
  175 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  176 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  177 + return this.msgBuilder.getSMPPMessage();
  178 + }*/
  179 +
  180 + public ArrayList<EquinoxRawData> getDiameterRequest(ArrayList<EQXRawInstance> eqxRawList){
  181 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  182 + for (int i = 0; i < eqxRawList.size(); i++) {
  183 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  184 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  185 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  186 + eqxRawDataList.add(this.msgBuilder.getDiameterMessage());
  187 + }
  188 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("Diameter-timeout").get(0);
  189 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  190 + this.ec02Ins.setTimeout(timeout);
  191 +
  192 + return eqxRawDataList;
  193 + }
  194 +
  195 + public EquinoxRawData getDiameterResponse(EQXRawInstance eqxRaw){
  196 + eqxRaw.setType(EQXMsg.RESPONSE);
  197 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  198 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  199 + return this.msgBuilder.getDiameterMessage();
  200 + }
  201 +
  202 + public void getE01Request() {
  203 + this.getE01Request(false);
  204 + }
  205 +
  206 + public void getE01Request(boolean bool) {
  207 + String serviceName = this.ec02Ins.getE01Ins().getServiceName();
  208 + if (serviceName == null) {
  209 + serviceName = this.abstractAF.getUtils().getHmWarmConfig().get("Resource-Name-E01").get(0).trim();
  210 + }
  211 + this.abstractAF.getUtils().getGlobalData().configService(serviceName);
  212 + KeyObject keyobj = new KeyObject();
  213 + keyobj.setObjectType(this.ec02Ins.getE01Ins().getObjType());
  214 + ArrayList<String> keyList = this.ec02Ins.getE01Ins().getKey();
  215 +// for (int i = 0; i < keyList.size(); i++) {
  216 +// AppLog.d("## key " + i + " " + keyList.get(i));
  217 +// keyobj.setKey(String.valueOf(i), keyList.get(i));
  218 +// }
  219 + String[] stringArray = keyList.toArray(new String[keyList.size()]);
  220 + for (int i = 0; i < stringArray.length; i++) {
  221 + AppLog.d("## key " + i + " " + stringArray[i]);
  222 + }
  223 + AppLog.d("## keyObj :" + stringArray.length);
  224 + if(this.ec02Ins.getE01Ins().getCmd().equals("search")){
  225 +// this.abstractAF.getUtils().getGlobalData().search(keyobj, this.ec02Ins.getE01Ins().getId());
  226 + this.abstractAF.getUtils().getGlobalData().search(this.ec02Ins.getE01Ins().getObjType(), stringArray, this.ec02Ins.getE01Ins().getId());
  227 + }
  228 + else if(this.ec02Ins.getE01Ins().getCmd().equals("delete")){
  229 + this.abstractAF.getUtils().getGlobalData().delete(keyobj, this.ec02Ins.getE01Ins().getId());
  230 + }
  231 + else if(this.ec02Ins.getE01Ins().getCmd().equals("add")){
  232 + this.abstractAF.getUtils().getGlobalData().add(keyobj, this.ec02Ins.getE01Ins().getData(), this.ec02Ins.getE01Ins().getId());
  233 + }
  234 + else if(this.ec02Ins.getE01Ins().getCmd().equals("replace")){
  235 + this.abstractAF.getUtils().getGlobalData().replace(keyobj, this.ec02Ins.getE01Ins().getData(), this.ec02Ins.getE01Ins().getId());
  236 + }
  237 + this.abstractAF.getUtils().getGlobalData().setTransactionId(this.ec02Ins.getE01Ins().getInvoke());
  238 + // timeout
  239 + String timeout = this.ec02Ins.getE01Ins().getTimeout();
  240 + if (timeout != null) {
  241 + this.ec02Ins.setTimeout(timeout);
  242 + }
  243 + if (bool) {
  244 + String objType = this.ec02Ins.getE01Ins().getObjType();
  245 + this.ec02Ins.getAFInstance().getListStat().add(new Stat(this.ec02Ins.getAFInstance().getCurrentState(), Constant.TYPE_SEND, Constant.TYPE_REQUEST, Constant.TYPE_SUCCESS, objType));
  246 + } else {
  247 + this.ec02Ins.getAFInstance().getListStat().add(new Stat(this.ec02Ins.getAFInstance().getCurrentState(), Constant.TYPE_SEND, Constant.TYPE_REQUEST));
  248 + }
  249 + }
  250 +
  251 + public void getE01AtomicRequest()
  252 + {
  253 + String command = this.ec02Ins.getAtomic().getCommand();
  254 + String atomicName = this.ec02Ins.getAtomic().getName();
  255 + if (command.equals(Atomic.command_get)) {
  256 + this.abstractAF.getUtils().getGlobalData().get(atomicName);
  257 + } else if(command.equals(Atomic.command_increase)) {
  258 + long atomicValue = this.ec02Ins.getAtomic().getValue();
  259 + this.abstractAF.getUtils().getGlobalData().increase(atomicName, atomicValue, this.ec02Ins.getAtomic().getMin(), this.ec02Ins.getAtomic().getMax());
  260 + } else if(command.equals(Atomic.command_clear)) {
  261 + this.abstractAF.getUtils().getGlobalData().clear(atomicName);
  262 + }
  263 + this.abstractAF.getUtils().getGlobalData().setTransactionId(this.ec02Ins.getE01Ins().getInvoke());
  264 + this.ec02Ins.getAFInstance().getListStat().add(new Stat(this.ec02Ins.getAFInstance().getCurrentState(), Constant.TYPE_SEND, Constant.TYPE_REQUEST));
  265 + // timeout
  266 + String timeout = this.ec02Ins.getE01Ins().getTimeout();
  267 + if (timeout != null) {
  268 + this.ec02Ins.setTimeout(timeout);
  269 + }
  270 + }
  271 +
  272 + public EquinoxRawData getUpdateIns(){
  273 + this.msgBuilder = new EC02MSGBuilder();
  274 + this.ec02Ins.setTimeout(this.abstractAF.getUtils().getHmWarmConfig().get("Update-Instance-timeout").get(0));
  275 + return this.msgBuilder.getUpdateIns();
  276 + }
  277 +
  278 + private void logDetailOutput(EquinoxRawData equinoxRawData, Object data, String nodeTo, String command)
  279 + {
  280 + if (Log.debug) {
  281 + AppLog.d("## LOGDETAIL_OUTPUT NODETO:" + nodeTo + " command:" + command);
  282 + }
  283 + // Log Detail Output
  284 + if (data != null) {
  285 + String currentState = "";
  286 + String cmd = (command == null ) ? StateConfig.getCommandFromState(currentState) : command;
  287 + if (nodeTo == null && currentState != null) {
  288 + String eventType = StateConfig.getEventTypeFromSubState(currentState);
  289 + nodeTo = Global.getNodeFromEventType(eventType);
  290 + }
  291 + String invoke = equinoxRawData.getInvoke();
  292 + String type = equinoxRawData.getRawDataAttribute("type");
  293 + String rawData = EqxStringUtils.getMessage(equinoxRawData, null, false);
  294 +
  295 + DetailsLogPrototype detLog = this.ec02Ins.getAFInstance().getDetaillog();
  296 + DataBean output = new DataBean();
  297 + output.setInvoke(invoke);
  298 + output.setDirector(nodeTo);
  299 + output.setCommandName(cmd);
  300 +
  301 + if(type.equals("response")) {
  302 + output.setType(TYPE.RES);
  303 + } else {
  304 + output.setType(TYPE.REQ);
  305 + }
  306 +
  307 + output.setJsonData(MessageParser.toJsonObject(data));
  308 + output.setRawData(Global.getDetailLogRawData(rawData));
  309 + try {
  310 + detLog.addOutput(output);
  311 + } catch (CommonLogException e) {
  312 + // TODO Auto-generated catch block
  313 + e.printStackTrace();
  314 + }
  315 + }
  316 + }
  317 +}
... ...
src/th/co/ais/ssbsrfc/message/EC02MSGBuilder.java 0 → 100644
... ... @@ -0,0 +1,143 @@
  1 +package th.co.ais.ssbsrfc.message;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  7 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  8 +import ec02.af.data.EquinoxRawData;
  9 +
  10 +public class EC02MSGBuilder {
  11 + private String message = null;
  12 + private EQXRawInstance eqxRawIns = null;
  13 + private EquinoxRawData eqxRawDatas = null;
  14 + private Map<String, String> map = new HashMap<String, String>();
  15 + private String invoke = null;
  16 +
  17 + public EC02MSGBuilder(){
  18 + this.eqxRawDatas = new EquinoxRawData();
  19 + }
  20 +
  21 + public EC02MSGBuilder(EQXRawInstance eqxRawIns){
  22 + this.setEqxRawIns(eqxRawIns);
  23 + this.eqxRawDatas = new EquinoxRawData();
  24 + }
  25 +
  26 + public String getMessage() {
  27 + return message;
  28 + }
  29 +
  30 + public void setMessage(String message) {
  31 + this.message = message;
  32 + }
  33 +
  34 + public Map<String, String> getMap() {
  35 + return map;
  36 + }
  37 +
  38 + public void setMap(Map<String, String> map) {
  39 + this.map = map;
  40 + }
  41 +
  42 + public String getInvoke() {
  43 + return invoke;
  44 + }
  45 +
  46 + public void setInvoke(String invoke) {
  47 + this.invoke = invoke;
  48 + }
  49 +
  50 + public EquinoxRawData getDiameterMessage() {
  51 + String invoke = this.eqxRawIns.getInvoke();
  52 + if (this.invoke != null || invoke != null) {
  53 + if (invoke != null) {
  54 + this.map.put(EQXMsg.INVOKE, invoke);
  55 + } else {
  56 + this.map.put(EQXMsg.INVOKE, this.invoke);
  57 + }
  58 + }
  59 + this.map.put(EQXMsg.NAME, EQXMsg.DIAMETER);
  60 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  61 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  62 + this.eqxRawDatas.setRawDataAttributes(this.map);
  63 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  64 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  65 +
  66 + return this.eqxRawDatas;
  67 + }
  68 +
  69 + public EquinoxRawData getHttpMessage() {
  70 + String invoke = this.eqxRawIns.getInvoke();
  71 + if (this.invoke != null || invoke != null) {
  72 + if (invoke != null) {
  73 + this.map.put(EQXMsg.INVOKE, invoke);
  74 + } else {
  75 + this.map.put(EQXMsg.INVOKE, this.invoke);
  76 + }
  77 + }
  78 + if (this.eqxRawIns.getName() != null) {
  79 + this.map.put(EQXMsg.NAME, this.eqxRawIns.getName());
  80 + } else {
  81 + this.map.put(EQXMsg.NAME, EQXMsg.HTTP);
  82 + }
  83 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  84 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  85 + // #TOM
  86 + if (this.eqxRawIns.getUrl() != null) {
  87 + this.map.put(EQXMsg.URL, this.eqxRawIns.getUrl());
  88 + }
  89 + if (this.eqxRawIns.getMethod() != null) {
  90 + this.map.put(EQXMsg.METHOD, this.eqxRawIns.getMethod());
  91 + }
  92 + // END
  93 + if(this.eqxRawIns.getCtype().equals(EQXMsg.TEXTPLAIN) || this.eqxRawIns.getCtype().equals(EQXMsg.TEXTHTML)) {
  94 + this.map.put(EQXMsg.VAL, this.eqxRawIns.getMessage());
  95 + }
  96 + else {
  97 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  98 + }
  99 + this.eqxRawDatas.setRawDataAttributes(this.map);
  100 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  101 +
  102 + return this.eqxRawDatas;
  103 + }
  104 +
  105 + public EquinoxRawData getLdapMessage() {
  106 + if (this.invoke != null)
  107 + this.map.put(EQXMsg.INVOKE, this.invoke);
  108 + this.map.put(EQXMsg.NAME, EQXMsg.LDAP);
  109 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  110 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  111 + this.map.put(EQXMsg.OID, this.eqxRawIns.getOid());
  112 + this.eqxRawDatas.setRawDataAttributes(this.map);
  113 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  114 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  115 +
  116 + return this.eqxRawDatas;
  117 + }
  118 +
  119 + public EquinoxRawData getSMPPMessage() {
  120 + if (this.invoke != null)
  121 + this.map.put(EQXMsg.INVOKE, this.invoke);
  122 + this.map.put(EQXMsg.NAME, EQXMsg.SMPP);
  123 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  124 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  125 + this.eqxRawDatas.setRawDataAttributes(this.map);
  126 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  127 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  128 +
  129 + return this.eqxRawDatas;
  130 + }
  131 +
  132 + public EquinoxRawData getUpdateIns() {
  133 + return this.eqxRawDatas;
  134 + }
  135 +
  136 + public EQXRawInstance getEqxRawIns() {
  137 + return eqxRawIns;
  138 + }
  139 +
  140 + public void setEqxRawIns(EQXRawInstance eqxRawIns) {
  141 + this.eqxRawIns = eqxRawIns;
  142 + }
  143 +}
... ...
src/th/co/ais/ssbsrfc/message/MSGParser.java 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +package th.co.ais.ssbsrfc.message;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.instance.AFInstance;
  6 +import th.co.ais.ssbsrfc.instance.E01Instance;
  7 +
  8 +public class MSGParser {
  9 + private String msg = "";
  10 + private E01Instance e01Ins = null;
  11 + private AFInstance afInstance = null;
  12 +
  13 +
  14 +
  15 + public MSGParser(String msg){
  16 + this.msg = msg;
  17 + }
  18 +
  19 + public void extractHTTPMessage(AFInstance afIns){
  20 + this.afInstance = afIns;
  21 +
  22 + }
  23 +
  24 + public void extractE01Message(E01Instance e01Ins){
  25 + this.e01Ins = e01Ins;
  26 + ArrayList<String> key = null;
  27 + String [] e01msg = this.msg.split(":");
  28 + String [] cmd = e01msg[0].split("=");
  29 + this.e01Ins.setCmd(cmd[1].trim());
  30 + String [] e01objAndkey = e01msg[1].split(",");
  31 + for(int i = 0; i < e01objAndkey.length; i++){
  32 + String [] e01val = e01objAndkey[i].split("=");
  33 + if(e01val[0].trim().equalsIgnoreCase("objecttype")){
  34 + this.e01Ins.setObjType(e01val[1].trim());
  35 + }
  36 + else if(e01val[0].contains("key")){
  37 + if(key == null){
  38 + key = new ArrayList<String>();
  39 + }
  40 + key.add(e01val[1].trim());
  41 + }
  42 + else if(e01val[0].trim().equalsIgnoreCase("data")){
  43 + this.e01Ins.setData(e01val[1].trim());
  44 + }
  45 + else if(e01val[0].trim().equalsIgnoreCase("id")){
  46 + this.e01Ins.setId(e01val[1].trim());
  47 + }
  48 + }
  49 +
  50 + this.e01Ins.setKey(key);
  51 + }
  52 +
  53 + public E01Instance getE01Ins() {
  54 + return e01Ins;
  55 + }
  56 +
  57 + public void setE01Ins(E01Instance e01Ins) {
  58 + this.e01Ins = e01Ins;
  59 + }
  60 +
  61 + public AFInstance getAFInstance() {
  62 + return afInstance;
  63 + }
  64 +
  65 + public void setMsgIns(AFInstance afInstance) {
  66 + this.afInstance = afInstance;
  67 + }
  68 +}
... ...
src/th/co/ais/ssbsrfc/message/MessageParser.java 0 → 100644
... ... @@ -0,0 +1,330 @@
  1 +package th.co.ais.ssbsrfc.message;
  2 +
  3 +import java.io.ByteArrayInputStream;
  4 +import java.io.Reader;
  5 +import java.io.StringReader;
  6 +import java.io.StringWriter;
  7 +
  8 +import javax.xml.bind.JAXBContext;
  9 +import javax.xml.bind.JAXBElement;
  10 +import javax.xml.bind.JAXBException;
  11 +import javax.xml.bind.Marshaller;
  12 +import javax.xml.bind.Unmarshaller;
  13 +import javax.xml.parsers.DocumentBuilderFactory;
  14 +import javax.xml.soap.MessageFactory;
  15 +import javax.xml.soap.SOAPBody;
  16 +import javax.xml.soap.SOAPEnvelope;
  17 +import javax.xml.soap.SOAPMessage;
  18 +import javax.xml.soap.SOAPPart;
  19 +import javax.xml.stream.XMLInputFactory;
  20 +import javax.xml.stream.XMLStreamException;
  21 +import javax.xml.stream.XMLStreamReader;
  22 +import javax.xml.transform.OutputKeys;
  23 +import javax.xml.transform.Transformer;
  24 +import javax.xml.transform.TransformerFactory;
  25 +import javax.xml.transform.dom.DOMSource;
  26 +import javax.xml.transform.stream.StreamResult;
  27 +
  28 +import com.google.gson.Gson;
  29 +import com.google.gson.GsonBuilder;
  30 +import com.google.gson.JsonElement;
  31 +import com.google.gson.JsonObject;
  32 +
  33 +import ec02.utils.AppLog;
  34 +import th.co.ais.ssbsrfc.instance.AdjustmentResponseIns;
  35 +import th.co.ais.ssbsrfc.instance.SOAPNamespaceMapper;
  36 +
  37 +public class MessageParser
  38 +{
  39 + public static String toXml(Object obj) {
  40 + String strXml = "";
  41 + StringWriter sw = new StringWriter();
  42 +
  43 + try {
  44 + JAXBContext jc = JAXBContext.newInstance(obj.getClass());
  45 +
  46 + Marshaller marshaller = jc.createMarshaller();
  47 + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
  48 + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
  49 + marshaller.marshal(obj, sw);
  50 + strXml = sw.toString();
  51 + } catch (Exception e) {
  52 + e.printStackTrace();
  53 + }
  54 +
  55 + return strXml;
  56 + }
  57 +
  58 + public static String toXmlWithoutRoot(Object obj) {
  59 + String strXml = "";
  60 + StringWriter sw = new StringWriter();
  61 +
  62 + try {
  63 + JAXBContext jc = JAXBContext.newInstance(obj.getClass());
  64 +
  65 + Marshaller marshaller = jc.createMarshaller();
  66 + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
  67 + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
  68 + marshaller.marshal(obj, sw);
  69 + strXml = sw.toString().replace("<root>", "").replace("</root>", "");
  70 + } catch (Exception e) {
  71 + e.printStackTrace();
  72 + }
  73 +
  74 + return strXml;
  75 + }
  76 +
  77 + public static String toXml(Object obj, String rootElement) {
  78 + String strXml = "";
  79 + StringWriter sw = new StringWriter();
  80 +
  81 + try {
  82 + JAXBContext jc = JAXBContext.newInstance(obj.getClass());
  83 +
  84 + Marshaller marshaller = jc.createMarshaller();
  85 + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
  86 + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
  87 + marshaller.marshal(obj, sw);
  88 + strXml = sw.toString().replace("root", rootElement);
  89 + } catch (Exception e) {
  90 + e.printStackTrace();
  91 + }
  92 +
  93 + return strXml;
  94 + }
  95 +
  96 + @SuppressWarnings("rawtypes")
  97 + public static String toXmlWithNamespace(Object obj, Class objClass, Object namespaceMapper) {
  98 + String strXml = "";
  99 + StringWriter sw = new StringWriter();
  100 +
  101 + try {
  102 + JAXBContext jc = JAXBContext.newInstance(objClass);
  103 +
  104 + Marshaller marshaller = jc.createMarshaller();
  105 + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
  106 + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
  107 + marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", namespaceMapper);
  108 + marshaller.marshal(obj, sw);
  109 + strXml = sw.toString();
  110 + } catch (Exception e) {
  111 + e.printStackTrace();
  112 + }
  113 +
  114 + return strXml;
  115 + }
  116 +
  117 + @SuppressWarnings("rawtypes")
  118 + public static Object fromXml(String strXml, Class objClass) {
  119 + Object obj = null;
  120 +
  121 + try {
  122 + strXml = removeXmlVersion(strXml);
  123 + JAXBContext jc = JAXBContext.newInstance(objClass);
  124 + Unmarshaller unmarshaller = jc.createUnmarshaller();
  125 + StringReader reader = new StringReader(strXml);
  126 +
  127 + obj = unmarshaller.unmarshal(reader);
  128 + } catch (Exception e) {
  129 + e.printStackTrace();
  130 + }
  131 +
  132 + return obj;
  133 + }
  134 +
  135 + @SuppressWarnings("rawtypes")
  136 + public static Object fromXmlWithoutRoot(String strXml, Class objClass) {
  137 + Object obj = null;
  138 +
  139 + try {
  140 + strXml = "<root>" + removeXmlVersion(strXml) + "</root>";
  141 + JAXBContext jc = JAXBContext.newInstance(objClass);
  142 + Unmarshaller unmarshaller = jc.createUnmarshaller();
  143 + StringReader reader = new StringReader(strXml);
  144 +
  145 + obj = unmarshaller.unmarshal(reader);
  146 + } catch (Exception e) {
  147 + e.printStackTrace();
  148 + }
  149 +
  150 + return obj;
  151 + }
  152 +
  153 + public static String toSoap(Object obj) {
  154 + String message = "";
  155 +
  156 + try {
  157 + JAXBContext jc = JAXBContext.newInstance(obj.getClass());
  158 +
  159 + MessageFactory messageFactory = MessageFactory.newInstance();
  160 + SOAPMessage outgoingMessage = messageFactory.createMessage();
  161 + SOAPPart soappart = outgoingMessage.getSOAPPart();
  162 + SOAPEnvelope envelope = soappart.getEnvelope();
  163 + envelope.addNamespaceDeclaration("def", "http://definition.webservices.daa.ema.com/");
  164 +
  165 + envelope.removeNamespaceDeclaration("SOAP-ENV");
  166 + envelope.removeNamespaceDeclaration("cbs");
  167 + envelope.removeNamespaceDeclaration("arc");
  168 + envelope.removeNamespaceDeclaration("ars");
  169 + envelope.addNamespaceDeclaration("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
  170 + envelope.addNamespaceDeclaration("cbs", "http://www.huawei.com/bme/cbsinterface/cbscommon");
  171 + envelope.addNamespaceDeclaration("arc", "http://cbs.huawei.com/ar/wsservice/arcommon");
  172 + envelope.addNamespaceDeclaration("ars", "http://www.huawei.com/bme/cbsinterface/arservices");
  173 + envelope.setPrefix("soapenv");
  174 + outgoingMessage.getSOAPHeader().setPrefix("soapenv");
  175 + outgoingMessage.getSOAPBody().setPrefix("soapenv");
  176 +
  177 + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  178 + org.w3c.dom.Document doc = dbf.newDocumentBuilder().newDocument();
  179 + Marshaller marshaller = jc.createMarshaller();
  180 + marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
  181 + marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new SOAPNamespaceMapper());
  182 + marshaller.marshal( obj, doc );
  183 +
  184 + SOAPBody body = envelope.getBody();
  185 + body.addDocument(doc);
  186 +
  187 + outgoingMessage.saveChanges();
  188 +
  189 + StringWriter sw = new StringWriter();
  190 + Transformer transformer = TransformerFactory.newInstance().newTransformer();
  191 + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  192 + transformer.transform(new DOMSource(outgoingMessage.getSOAPPart()), new StreamResult(sw));
  193 +
  194 + message = sw.toString();
  195 + } catch (Exception e) {
  196 + e.printStackTrace();
  197 + }
  198 +
  199 + return message;
  200 + }
  201 +
  202 + public static String toSoap(Object obj, String namespacePrefix, String namespaceUrl) {
  203 + String message = "";
  204 +
  205 + try {
  206 + JAXBContext jc = JAXBContext.newInstance(obj.getClass());
  207 +
  208 + MessageFactory messageFactory = MessageFactory.newInstance();
  209 + SOAPMessage outgoingMessage = messageFactory.createMessage();
  210 + SOAPPart soappart = outgoingMessage.getSOAPPart();
  211 + SOAPEnvelope envelope = soappart.getEnvelope();
  212 + envelope.addNamespaceDeclaration(namespacePrefix, namespaceUrl);
  213 +
  214 + envelope.removeNamespaceDeclaration("SOAP-ENV");
  215 + envelope.addNamespaceDeclaration("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
  216 + envelope.setPrefix("soapenv");
  217 + outgoingMessage.getSOAPHeader().setPrefix("soapenv");
  218 + outgoingMessage.getSOAPBody().setPrefix("soapenv");
  219 +
  220 + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  221 + org.w3c.dom.Document doc = dbf.newDocumentBuilder().newDocument();
  222 + Marshaller marshaller = jc.createMarshaller();
  223 + marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
  224 + marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new SOAPNamespaceMapper() );
  225 + marshaller.marshal( obj, doc );
  226 +
  227 + SOAPBody body = envelope.getBody();
  228 + body.addDocument(doc);
  229 +
  230 + outgoingMessage.saveChanges();
  231 +
  232 + StringWriter sw = new StringWriter();
  233 + Transformer transformer = TransformerFactory.newInstance().newTransformer();
  234 + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  235 + transformer.transform(new DOMSource(outgoingMessage.getSOAPPart()), new StreamResult(sw));
  236 +
  237 + message = sw.toString();
  238 + } catch (Exception e) {
  239 + e.printStackTrace();
  240 + }
  241 +
  242 + return message;
  243 + }
  244 +
  245 + @SuppressWarnings("rawtypes")
  246 + public static Object fromSoap(String strSoap, Class objClass) {
  247 + Object obj = null;
  248 +
  249 + try {
  250 + SOAPMessage message = MessageFactory.newInstance().createMessage(null, new ByteArrayInputStream(strSoap.getBytes()));
  251 + Unmarshaller unmarshaller = JAXBContext.newInstance(objClass).createUnmarshaller();
  252 + SOAPBody body = message.getSOAPBody();
  253 + if(body != null && !body.getTextContent().trim().equals("")) {
  254 + obj = unmarshaller.unmarshal(body.extractContentAsDocument());
  255 + }
  256 + } catch (Exception e) {
  257 + e.printStackTrace();
  258 + }
  259 +
  260 + return obj;
  261 + }
  262 +
  263 + public static AdjustmentResponseIns formsoap(String ss) throws XMLStreamException, JAXBException{
  264 +
  265 + Reader reader = new StringReader(ss);
  266 + XMLInputFactory factory = XMLInputFactory.newInstance(); // Or newFactory()
  267 + XMLStreamReader xsr = factory.createXMLStreamReader(reader);
  268 +
  269 + AppLog.d("IN:"+xsr);
  270 + xsr.nextTag();
  271 + int i =0;
  272 + while(!xsr.getLocalName().equals("ResultHeader")) {
  273 + xsr.nextTag();
  274 + AppLog.d("I HERE:"+i++);
  275 + }
  276 +
  277 + JAXBContext jc = JAXBContext.newInstance(AdjustmentResponseIns.class);
  278 + Unmarshaller unmarshaller = jc.createUnmarshaller();
  279 + JAXBElement<AdjustmentResponseIns> jb = unmarshaller.unmarshal(xsr, AdjustmentResponseIns.class);
  280 + xsr.close();
  281 +
  282 + AdjustmentResponseIns customer = jb.getValue();
  283 + return customer;
  284 + }
  285 +
  286 + public static String toJson(Object obj) {
  287 + String strJson = "";
  288 +
  289 + try {
  290 + Gson gson = new GsonBuilder().disableHtmlEscaping().create();
  291 + strJson = gson.toJson(obj, obj.getClass());
  292 + } catch (Exception e) {
  293 + e.printStackTrace();
  294 + }
  295 +
  296 + return strJson;
  297 + }
  298 +
  299 + @SuppressWarnings({ "rawtypes", "unchecked" })
  300 + public static Object fromJson(String strJson, Class objClass) {
  301 + Object obj = null;
  302 + try {
  303 + Gson gson = new Gson();
  304 + obj = gson.fromJson(strJson, objClass);
  305 + } catch (Exception e) {
  306 + e.printStackTrace();
  307 + }
  308 +
  309 + return obj;
  310 + }
  311 +
  312 + public static JsonObject toJsonObject(Object obj) {
  313 + JsonObject jsonObj = null;
  314 +
  315 + try {
  316 + Gson gson = new Gson();
  317 + JsonElement element = gson.fromJson (MessageParser.toJson(obj), JsonElement.class);
  318 + jsonObj = element.getAsJsonObject();
  319 + } catch (Exception e) {
  320 + e.printStackTrace();
  321 + }
  322 +
  323 + return jsonObj;
  324 + }
  325 +
  326 + private static String removeXmlVersion(String value)
  327 + {
  328 + return value.replaceAll("\\<\\?xml(.+?)\\?\\>", "");
  329 + }
  330 +}
... ...
src/th/co/ais/ssbsrfc/state/StateIdle.java 0 → 100644
... ... @@ -0,0 +1,115 @@
  1 +package th.co.ais.ssbsrfc.state;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import th.co.ais.ssbsrfc.config.Constant;
  7 +import th.co.ais.ssbsrfc.config.StateConfig;
  8 +import th.co.ais.ssbsrfc.control.FlowManager;
  9 +import th.co.ais.ssbsrfc.control.SubStateManager;
  10 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  11 +import th.co.ais.ssbsrfc.instance.ManageTime;
  12 +import th.co.ais.ssbsrfc.utils.Global;
  13 +import th.co.ais.ssbsrfc.utils.Log;
  14 +import ec02.af.abstracts.AbstractAF;
  15 +import ec02.af.data.EquinoxRawData;
  16 +import ec02.af.interfaces.IAFState;
  17 +import ec02.utils.AppLog;
  18 +
  19 +public class StateIdle implements IAFState {
  20 +
  21 + private String eqxState = null;
  22 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  23 +
  24 + @Override
  25 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  26 + AppLog.d("[### StateIdle ###]");
  27 + EC02Instance ec02Instance = (EC02Instance) instance;
  28 + Global.getConfigEC02(abstractAF, ec02Instance);
  29 + // MultiFlow new
  30 + if (StateConfig.isMultiFlow) {
  31 + // E01 Recieve
  32 + if (abstractAF.getUtils().getGlobalData().isRecieve()) {
  33 + EquinoxRawData eqxRaw = new EquinoxRawData();
  34 + eqxRaw.setInvoke(abstractAF.getUtils().getGlobalData().getTransactionId());
  35 + eqxRaw.setType(Constant.RESPONSE.toLowerCase());
  36 + eqxRaw.setRawEventType(StateConfig.Incoming_Unknown);
  37 +
  38 + this.subStateManager(abstractAF, ec02Instance, eqxRaw);
  39 + Log.detailLog(ec02Instance, abstractAF, StateConfig.STATE_IDLE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  40 + Log.summaryLog(ec02Instance, abstractAF);
  41 + }
  42 + // rowdatalist
  43 + if (eqxRawDataList != null) {
  44 + FlowManager flowManager = new FlowManager(abstractAF, ec02Instance);
  45 + for(EquinoxRawData equinoxRawData : eqxRawDataList) {
  46 + // manage flow start
  47 + flowManager.start(equinoxRawData);
  48 + this.subStateManager(abstractAF, ec02Instance, equinoxRawData);
  49 + flowManager.end(StateConfig.STATE_IDLE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  50 + }
  51 + }
  52 + ec02Instance.setEqxRawDataList(this.eqxRawDataList);
  53 + } else {
  54 + for(EquinoxRawData equinoxRawData : eqxRawDataList) {
  55 + ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
  56 + String eventType = equinoxRawData.getRawEventType();
  57 + String ssName = StateConfig.getSubStateFromEventType(eventType);
  58 + SubStateManager subStateManager = new SubStateManager(ssName);
  59 + List<EquinoxRawData> eqxList = subStateManager.doActionSubState(abstractAF, ec02Instance, equinoxRawData);
  60 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  61 + for(EquinoxRawData eqx : eqxList) {
  62 + String type = eqx.getType();
  63 + String invoke = eqx.getInvoke();
  64 + if (type.equals("request") && (invoke.length() > 0 || invoke != null)) {
  65 + ec02Instance.getAFInstance().putDicInvoke(invoke, Global.getInvokeForManageFlow(ec02Instance));
  66 + }
  67 + this.eqxRawDataList.add(eqx);
  68 + }
  69 +
  70 + if (currentState.equals("END") || currentState.equals("")) {
  71 + this.eqxState = StateConfig.STATE_IDLE;
  72 + } else {
  73 + this.eqxState = StateConfig.STATE_ACTIVE;
  74 + }
  75 + }
  76 +
  77 + int count = ec02Instance.getAFInstance().getListTimeout().size();
  78 + if (count > 0 && ec02Instance.getTimeout() == null) {
  79 + ManageTime mt = new ManageTime(ec02Instance);
  80 + mt.setListTimeout(ec02Instance.getAFInstance().getListTimeout());
  81 + String timeout = mt.getCalTime();
  82 + ec02Instance.setTimeout(timeout);
  83 + }
  84 + Log.detailLog(ec02Instance, abstractAF, StateConfig.STATE_IDLE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  85 + Log.summaryLog(ec02Instance, abstractAF);
  86 + ec02Instance.setEqxRawDataList(this.eqxRawDataList);
  87 + }
  88 + AppLog.d("[### END StateIdle ###]");
  89 + return this.eqxState;
  90 + }
  91 +
  92 + public void subStateManager(AbstractAF abstractAF,EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  93 + {
  94 + String eventType = equinoxRawData.getRawEventType();
  95 + String ssName = StateConfig.getSubStateFromEventType(eventType);
  96 +
  97 + SubStateManager subStateManager = new SubStateManager(ssName);
  98 + List<EquinoxRawData> eqxList = subStateManager.doActionSubState(abstractAF, ec02Instance, equinoxRawData);
  99 + for(EquinoxRawData eqx : eqxList) {
  100 + String type = eqx.getType();
  101 + String invoke = eqx.getInvoke();
  102 + if (type.equals("request") && (invoke.length() > 0 || invoke != null)) {
  103 + ec02Instance.getAFInstance().putDicInvoke(invoke, Global.getInvokeForManageFlow(ec02Instance));
  104 + }
  105 + this.eqxRawDataList.add(eqx);
  106 + }
  107 + // END
  108 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  109 + if (currentState.equals("END")) {
  110 + this.eqxState = StateConfig.STATE_IDLE;
  111 + } else {
  112 + this.eqxState = StateConfig.STATE_ACTIVE;
  113 + }
  114 + }
  115 +}
... ...
src/th/co/ais/ssbsrfc/state/StateWaitActive.java 0 → 100644
... ... @@ -0,0 +1,135 @@
  1 +package th.co.ais.ssbsrfc.state;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import org.apache.commons.lang.ArrayUtils;
  7 +
  8 +import th.co.ais.ssbsrfc.config.Constant;
  9 +import th.co.ais.ssbsrfc.config.StateConfig;
  10 +import th.co.ais.ssbsrfc.control.FlowManager;
  11 +import th.co.ais.ssbsrfc.control.SubStateManager;
  12 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  13 +import th.co.ais.ssbsrfc.instance.ManageTime;
  14 +import th.co.ais.ssbsrfc.utils.Global;
  15 +import th.co.ais.ssbsrfc.utils.Log;
  16 +import ec02.af.abstracts.AbstractAF;
  17 +import ec02.af.data.EquinoxRawData;
  18 +import ec02.af.data.GlobalData;
  19 +import ec02.af.interfaces.IAFState;
  20 +import ec02.utils.AppLog;
  21 +
  22 +public class StateWaitActive implements IAFState {
  23 +
  24 + private String eqxState = null;
  25 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  26 +
  27 + @Override
  28 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  29 + AppLog.d("[### StateWaitActive ###]");
  30 + EC02Instance ec02Instance = (EC02Instance) instance;
  31 + Global.getConfigEC02(abstractAF, ec02Instance);
  32 + // MultiFlow new
  33 + if (StateConfig.isMultiFlow) {
  34 + FlowManager flowManager = new FlowManager(abstractAF, ec02Instance);
  35 + // E01
  36 + if (abstractAF.getUtils().getGlobalData().isRecieve() ) {
  37 + GlobalData e01 = abstractAF.getUtils().getGlobalData();
  38 + String invoke = e01.getTransactionId();
  39 + ec02Instance.getAFInstance().listTimeoutRemove(invoke);
  40 + EquinoxRawData equinoxRawData = new EquinoxRawData();
  41 + equinoxRawData.setInvoke(invoke);
  42 + flowManager.start(equinoxRawData);
  43 + this.subStateManager(abstractAF, ec02Instance, null);
  44 + flowManager.end(StateConfig.STATE_ACTIVE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  45 + } else if (eqxRawDataList.isEmpty()) { // TIMEOUT
  46 + ManageTime mt = new ManageTime();
  47 + mt.setListTimeout(ec02Instance.getAFInstance().getGlobalListTimeout());
  48 + List<String> listTimeout = mt.getState(false);
  49 + ec02Instance.getAFInstance().setGlobalListTimeout(mt.getListTimeout());
  50 + for (String unique : listTimeout) {
  51 + EquinoxRawData equinoxRawData = new EquinoxRawData();
  52 + equinoxRawData.getRawDataAttributes().put("unique", unique);
  53 + equinoxRawData.setRet("4");
  54 + flowManager.start(equinoxRawData);
  55 + this.subStateManager(abstractAF, ec02Instance, null);
  56 + flowManager.end(StateConfig.STATE_ACTIVE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  57 + }
  58 + }
  59 + // CASE SUCCESS, ERROR, REJECT, ABORT
  60 + else {
  61 + for(EquinoxRawData equinoxRawData : eqxRawDataList) {
  62 + flowManager.start(equinoxRawData);
  63 + this.subStateManager(abstractAF, ec02Instance, equinoxRawData);
  64 + flowManager.end(StateConfig.STATE_ACTIVE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  65 + }
  66 + }
  67 + ec02Instance.setEqxRawDataList(this.eqxRawDataList);
  68 + this.checkEqxState(ec02Instance);
  69 + } else {
  70 + // E01, TIMEOUT
  71 + if (abstractAF.getUtils().getGlobalData().isRecieve() || eqxRawDataList.isEmpty()) {
  72 + this.subStateManager(abstractAF, ec02Instance, null);
  73 + } else { // CASE SUCCESS, ERROR, REJECT, ABORT
  74 + for(EquinoxRawData equinoxRawData : eqxRawDataList) {
  75 + this.subStateManager(abstractAF, ec02Instance, equinoxRawData);
  76 + }
  77 + }
  78 +
  79 + int count = ec02Instance.getAFInstance().getListTimeout().size();
  80 + if (count > 0 && ec02Instance.getTimeout() == null) {
  81 + ManageTime mt = new ManageTime(ec02Instance);
  82 + mt.setListTimeout(ec02Instance.getAFInstance().getListTimeout());
  83 + String timeout = mt.getCalTime();
  84 + if (timeout == null) {
  85 + timeout = "0";
  86 + }
  87 + ec02Instance.setTimeout(timeout);
  88 + }
  89 + Log.detailLog(ec02Instance, abstractAF, StateConfig.STATE_ACTIVE, this.eqxState, eqxRawDataList, this.eqxRawDataList);
  90 + Log.summaryLog(ec02Instance, abstractAF);
  91 + ec02Instance.setEqxRawDataList(this.eqxRawDataList);
  92 + this.checkEqxState(ec02Instance);
  93 + }
  94 + AppLog.d("[### END StateWaitActive ###]");
  95 + return this.eqxState;
  96 + }
  97 +
  98 + public void subStateManager(AbstractAF abstractAF,EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  99 + {
  100 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  101 + if (currentState.equals(StateConfig.SSTATE_END)) {
  102 + String eventType = equinoxRawData.getRawEventType();
  103 + currentState = StateConfig.getSubStateFromEventType(eventType);
  104 + }
  105 +
  106 + SubStateManager subStateManager = new SubStateManager(currentState);
  107 + List<EquinoxRawData> eqxList = subStateManager.doActionSubState(abstractAF, ec02Instance, equinoxRawData);
  108 + for(EquinoxRawData eqx : eqxList) {
  109 + String type = eqx.getType();
  110 + String invoke = eqx.getInvoke();
  111 + if (type.equals("request") && (invoke.length() > 0 || invoke != null)) {
  112 + ec02Instance.getAFInstance().putDicInvoke(invoke, Global.getInvokeForManageFlow(ec02Instance));
  113 + }
  114 + this.eqxRawDataList.add(eqx);
  115 + }
  116 +
  117 + // END
  118 + currentState = ec02Instance.getAFInstance().getCurrentState();
  119 + if (currentState.equals("END")) {
  120 + this.eqxState = StateConfig.STATE_IDLE;
  121 + } else {
  122 + this.eqxState = StateConfig.STATE_ACTIVE;
  123 + }
  124 + }
  125 +
  126 + public void checkEqxState(EC02Instance ec02Instance)
  127 + {
  128 + if (!ArrayUtils.contains(Constant.arrSingleFlow, ec02Instance.getAFInstance().getFlow())) {
  129 + int count = ec02Instance.getAFInstance().getListFlow().size();
  130 + if (count > 0 && this.eqxState.equals(StateConfig.STATE_IDLE)) {
  131 + this.eqxState = StateConfig.STATE_ACTIVE;
  132 + }
  133 + }
  134 + }
  135 +}
... ...
src/th/co/ais/ssbsrfc/state/StateWaitE11Timeout.java 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +package th.co.ais.ssbsrfc.state;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  6 +import ec02.af.abstracts.AbstractAF;
  7 +import ec02.af.data.EquinoxProperties;
  8 +import ec02.af.data.EquinoxRawData;
  9 +import ec02.af.interfaces.IAFState;
  10 +import ec02.utils.AppLog;
  11 +
  12 +public class StateWaitE11Timeout implements IAFState {
  13 +
  14 + private String eqxState = null;
  15 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  16 +
  17 + @Override
  18 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  19 + EC02Instance ec02Instance = (EC02Instance) instance;
  20 + for(EquinoxRawData equinoxRawData : eqxRawDataList) {
  21 + String eventType = equinoxRawData.getRawEventType();
  22 + AppLog.d("## EVENTTYPE :" + eventType);
  23 + }
  24 + // TIMEOUT
  25 + EquinoxProperties eqxProp = ec02Instance.getEquinoxProperties();
  26 + String diag = eqxProp.getDiag();
  27 + if (diag.equals("Timeout")) {
  28 + AppLog.d("## RET:4 DIAG:TIMEOUT");
  29 + }
  30 + ec02Instance.setEqxRawDataList(this.eqxRawDataList);
  31 + return this.eqxState;
  32 + }
  33 +
  34 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubMessages.java 0 → 100644
... ... @@ -0,0 +1,84 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import ec02.af.abstracts.AbstractAF;
  4 +import ec02.utils.AppLog;
  5 +import th.co.ais.ssbsrfc.config.Invoke;
  6 +import th.co.ais.ssbsrfc.config.StateConfig;
  7 +import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
  8 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  9 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  10 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  11 +import th.co.ais.ssbsrfc.message.MessageParser;
  12 +import th.co.ais.ssbsrfc.utils.Global;
  13 +
  14 +
  15 +
  16 +public class SubMessages {
  17 +
  18 + public static EQXRawInstance getRawAdjustmentRequest(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr)
  19 + {
  20 +
  21 + AdjustmentRequestIns ins = ajr;
  22 + String message = MessageParser.toSoap(ins);
  23 + EQXRawInstance eqxRaw = new EQXRawInstance();
  24 + String command = "Test B";
  25 + String to = Global.getEC02WarmConfig("Resource-Name-SDF");
  26 + String session = "SESSION";
  27 + Invoke iv = new Invoke("B",session,command,eventType,null);
  28 + String invoke = iv.toString();
  29 + eqxRaw.setMessage(message);
  30 + eqxRaw.setTo(to);
  31 + eqxRaw.setInvoke(invoke);
  32 + eqxRaw.setCtype(EQXMsg.TEXTPLAIN);
  33 +
  34 + return eqxRaw;
  35 + }
  36 +
  37 + public static EQXRawInstance getRawAResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)
  38 + {
  39 + String message = "Hello";
  40 + String command = "A";
  41 +
  42 + EQXRawInstance eqxRaw = new EQXRawInstance();
  43 + eqxRaw.setMessage(message);
  44 + eqxRaw.setTo(to);
  45 + eqxRaw.setInvoke(invoke);
  46 + eqxRaw.setCtype(EQXMsg.TEXTPLAIN);
  47 + eqxRaw.setCommand(command);
  48 +
  49 + return eqxRaw;
  50 + }
  51 +
  52 + public static EQXRawInstance getRawChargeRequestResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)
  53 + {
  54 + String message = mag;
  55 + String command = "A";
  56 +
  57 + EQXRawInstance eqxRaw = new EQXRawInstance();
  58 + eqxRaw.setMessage(message);
  59 + eqxRaw.setTo(to);
  60 + eqxRaw.setInvoke(invoke);
  61 + eqxRaw.setCtype(EQXMsg.TEXTPLAIN);
  62 + eqxRaw.setCommand(command);
  63 +
  64 + return eqxRaw;
  65 + }
  66 +
  67 +
  68 + public static EQXRawInstance getRawChargeReportResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)
  69 + {
  70 + String message = mag;
  71 + String command = "A";
  72 +
  73 + EQXRawInstance eqxRaw = new EQXRawInstance();
  74 + eqxRaw.setMessage(message);
  75 + eqxRaw.setTo(to);
  76 + eqxRaw.setInvoke(invoke);
  77 + eqxRaw.setCtype(EQXMsg.TEXTPLAIN);
  78 + eqxRaw.setCommand(command);
  79 +
  80 + return eqxRaw;
  81 + }
  82 +
  83 +
  84 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubMessagesE01.java 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +
  4 +
  5 +public class SubMessagesE01 {
  6 +
  7 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubWaitA.java 0 → 100644
... ... @@ -0,0 +1,54 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import th.co.ais.ssbsrfc.config.Constant;
  4 +import th.co.ais.ssbsrfc.config.StateConfig;
  5 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  6 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  7 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  8 +import ec02.af.abstracts.AbstractAF;
  9 +import ec02.af.data.EquinoxRawData;
  10 +import ec02.utils.AppLog;
  11 +
  12 +
  13 +public class SubWaitA extends WaitSubState {
  14 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  15 + {
  16 + this._state = StateConfig.SSTATE_W_A;
  17 + this._eventType = StateConfig.Incoming_A_Request;
  18 + this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;
  19 + if (equinoxRawData != null) {
  20 + ec02Instance.getAFInstance().setOrig(equinoxRawData.getOrig());
  21 + ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());
  22 + ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
  23 + }
  24 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);
  25 + }
  26 +
  27 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  28 + {
  29 + String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
  30 + AppLog.d("## PARAMETERS : " + value);
  31 + return value;
  32 + }
  33 +
  34 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  35 + {
  36 + AppLog.d("## TEST MSG SUBSTATE A");
  37 + this.type = Constant.TYPE_SUCCESS;
  38 + }
  39 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  40 + {
  41 + switch (this.type) {
  42 + case Constant.TYPE_SUCCESS:
  43 + default:
  44 + {
  45 +// this.isStat = false;
  46 +// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));
  47 +
  48 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  49 + EQXRawInstance eqxRaw = SubMessages.getRawAResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),"xx");
  50 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  51 + }
  52 + }
  53 + }
  54 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java 0 → 100644
... ... @@ -0,0 +1,75 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import javax.xml.bind.JAXBException;
  4 +import javax.xml.stream.XMLStreamException;
  5 +
  6 +import ec02.af.abstracts.AbstractAF;
  7 +import ec02.af.data.EquinoxRawData;
  8 +import ec02.utils.AppLog;
  9 +import th.co.ais.ssbsrfc.config.Constant;
  10 +import th.co.ais.ssbsrfc.config.StateConfig;
  11 +import th.co.ais.ssbsrfc.instance.AdjustmentResponseIns;
  12 +import th.co.ais.ssbsrfc.instance.ChargeReportIns;
  13 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  14 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  15 +import th.co.ais.ssbsrfc.message.MessageParser;
  16 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  17 +
  18 +
  19 +public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
  20 +
  21 + private ChargeReportIns chargeReportIns = new ChargeReportIns();
  22 +
  23 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  24 + {
  25 + this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT;
  26 + this._eventType = StateConfig.Incoming_Adjustment_ChargeReport_Response;
  27 + this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE;
  28 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);
  29 + }
  30 +
  31 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  32 + {
  33 + String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
  34 + AppLog.d("## PARAMETERS : " + value);
  35 +
  36 +
  37 + AdjustmentResponseIns ins = null;
  38 + try {
  39 + ins = (AdjustmentResponseIns) MessageParser.formsoap(value);
  40 + } catch (XMLStreamException e) {
  41 + // TODO Auto-generated catch block
  42 + e.printStackTrace();
  43 + } catch (JAXBException e) {
  44 + // TODO Auto-generated catch block
  45 + e.printStackTrace();
  46 + }
  47 + AppLog.d(ins.getVersion());
  48 + chargeReportIns.setResult("000");
  49 + chargeReportIns.setPrepaidsubscriberflag("1");
  50 +
  51 + return chargeReportIns;
  52 + }
  53 +
  54 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  55 + {
  56 +
  57 + this.type = Constant.TYPE_SUCCESS;
  58 + }
  59 +
  60 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  61 + {
  62 + switch (this.type) {
  63 + case Constant.TYPE_SUCCESS:
  64 + default:
  65 + {
  66 +// this.isStat = false;
  67 +// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));
  68 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
  69 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  70 + EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  71 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  72 + }
  73 + }
  74 + }
  75 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java 0 → 100644
... ... @@ -0,0 +1,83 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import java.io.Reader;
  4 +import java.io.StringReader;
  5 +
  6 +import javax.xml.bind.JAXBException;
  7 +import javax.xml.stream.XMLInputFactory;
  8 +import javax.xml.stream.XMLStreamException;
  9 +import javax.xml.stream.XMLStreamReader;
  10 +
  11 +import ec02.af.abstracts.AbstractAF;
  12 +import ec02.af.data.EquinoxRawData;
  13 +import ec02.utils.AppLog;
  14 +import th.co.ais.ssbsrfc.config.Constant;
  15 +import th.co.ais.ssbsrfc.config.StateConfig;
  16 +import th.co.ais.ssbsrfc.instance.AdjustmentResponseIns;
  17 +import th.co.ais.ssbsrfc.instance.ChargeResponseIns;
  18 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  19 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  20 +import th.co.ais.ssbsrfc.message.MessageParser;
  21 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  22 +
  23 +
  24 +public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState {
  25 +
  26 + private ChargeResponseIns chargeResponseIns = new ChargeResponseIns();
  27 +
  28 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  29 + {
  30 + this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST;
  31 + this._eventType = StateConfig.Incoming_Adjustment_ChargeRequest_Response;
  32 + this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE;
  33 + }
  34 +
  35 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  36 + {
  37 + String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
  38 + AppLog.d("## PARAMETERS : " + value);
  39 +
  40 + AdjustmentResponseIns ins=null;
  41 +
  42 + try {
  43 + ins = (AdjustmentResponseIns) MessageParser.formsoap(value);
  44 + } catch (XMLStreamException e) {
  45 + // TODO Auto-generated catch block
  46 + e.printStackTrace();
  47 + } catch (JAXBException e) {
  48 + // TODO Auto-generated catch block
  49 + e.printStackTrace();
  50 + }
  51 + AppLog.d("MsgLanguageCode:"+ins.getMsgLanguageCode());
  52 + chargeResponseIns.setResult("000");
  53 + chargeResponseIns.setdesc("SUCCESS");
  54 + chargeResponseIns.setChargingID("50928192340800649741");
  55 + chargeResponseIns.setPrepaidsubscriberflag("1");
  56 +
  57 + return chargeResponseIns;
  58 + }
  59 +
  60 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  61 + {
  62 +
  63 + this.type = Constant.TYPE_SUCCESS;
  64 + }
  65 +
  66 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  67 + {
  68 +
  69 + switch (this.type) {
  70 +
  71 + case Constant.TYPE_SUCCESS:
  72 + default:
  73 + {
  74 +// this.isStat = false;
  75 +// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));
  76 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
  77 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  78 + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  79 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  80 + }
  81 + }
  82 + }
  83 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java 0 → 100644
... ... @@ -0,0 +1,97 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import ec02.af.abstracts.AbstractAF;
  4 +import ec02.af.data.EquinoxRawData;
  5 +import ec02.utils.AppLog;
  6 +import th.co.ais.ssbsrfc.config.Constant;
  7 +import th.co.ais.ssbsrfc.config.StateConfig;
  8 +import th.co.ais.ssbsrfc.instance.AccessSecurity;
  9 +import th.co.ais.ssbsrfc.instance.AdjustmentInfo;
  10 +import th.co.ais.ssbsrfc.instance.AdjustmentObj;
  11 +import th.co.ais.ssbsrfc.instance.AdjustmentRequest;
  12 +import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
  13 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  14 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  15 +import th.co.ais.ssbsrfc.instance.OwnershipInfo;
  16 +import th.co.ais.ssbsrfc.instance.RequestHeader;
  17 +import th.co.ais.ssbsrfc.instance.SubAccessCode;
  18 +
  19 +
  20 +public class SubWaitChargeReport extends WaitSubState {
  21 +
  22 + AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns();
  23 +
  24 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  25 + {
  26 + this._state = StateConfig.SSTATE_W_CHARGEREPORT;
  27 + this._eventType = StateConfig.Incoming_ChargeReport_Request;
  28 + this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;
  29 + if (equinoxRawData != null) {
  30 + ec02Instance.getAFInstance().setOrig(equinoxRawData.getOrig());
  31 + ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());
  32 + ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
  33 + }
  34 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);
  35 + }
  36 +
  37 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  38 + {
  39 + RequestHeader requestHeader = new RequestHeader();
  40 + requestHeader.setVersion("1");
  41 + requestHeader.setBusinessCode("1");
  42 + requestHeader.setMessageSeq("20160429104931209");
  43 + OwnershipInfo ownershipInfo = new OwnershipInfo();
  44 + ownershipInfo.setBEID("101");
  45 + ownershipInfo.setBRID("101");
  46 + requestHeader.setOwnershipInfo(ownershipInfo);
  47 + AccessSecurity accessSecurity = new AccessSecurity();
  48 + accessSecurity.setLoginSystemCode("Xaysombath");
  49 + accessSecurity.setPassword("ATBoomuNQidKc8iYhPgx5A==");
  50 + requestHeader.setAccessSecurity(accessSecurity);
  51 + requestHeader.setAccessMode("3");
  52 +
  53 + AdjustmentRequest adjustmentrequest = new AdjustmentRequest();
  54 + adjustmentrequest.setAdjustmentSerialNo("20160429104632990");
  55 + AdjustmentObj adjustmentObj = new AdjustmentObj();
  56 + SubAccessCode subAccessCode = new SubAccessCode();
  57 + subAccessCode.setPrimaryIdentity("2055579910");
  58 + adjustmentObj.setSubAccessCode(subAccessCode);
  59 + adjustmentrequest.setAdjustmentObj(adjustmentObj);
  60 + adjustmentrequest.setOpType("1");
  61 + AdjustmentInfo adjustmentInfo = new AdjustmentInfo();
  62 + adjustmentInfo.setBalanceType("C_MAIN_ACCOUNT");
  63 + adjustmentInfo.setAdjustmentType("1");
  64 + adjustmentInfo.setAdjustmentAmt("1000");
  65 + adjustmentInfo.setCurrencyID("1049");
  66 + adjustmentrequest.setAdjustmentInfo(adjustmentInfo);
  67 +
  68 + adjustmentRequest.setRequestHeader(requestHeader);
  69 + adjustmentRequest.setAdjustmentRequest(adjustmentrequest);
  70 +
  71 + ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest);
  72 +
  73 + return adjustmentRequest;
  74 + }
  75 +
  76 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  77 + {
  78 + AppLog.d("## TEST MSG SUBSTATE A");
  79 + this.type = Constant.TYPE_SUCCESS;
  80 + }
  81 +
  82 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  83 + {
  84 + switch (this.type) {
  85 + case Constant.TYPE_SUCCESS:
  86 + default:
  87 + {
  88 +// this.isStat = false;
  89 +// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));
  90 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT);
  91 + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeReport_Response,adjustmentRequest);
  92 +
  93 + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));
  94 + }
  95 + }
  96 + }
  97 +}
... ...
src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java 0 → 100644
... ... @@ -0,0 +1,109 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import ec02.af.abstracts.AbstractAF;
  4 +import ec02.af.data.EquinoxRawData;
  5 +import ec02.utils.AppLog;
  6 +import th.co.ais.ssbsrfc.config.Constant;
  7 +import th.co.ais.ssbsrfc.config.StateConfig;
  8 +import th.co.ais.ssbsrfc.instance.AccessSecurity;
  9 +import th.co.ais.ssbsrfc.instance.AdjustmentInfo;
  10 +import th.co.ais.ssbsrfc.instance.AdjustmentObj;
  11 +import th.co.ais.ssbsrfc.instance.AdjustmentRequest;
  12 +import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
  13 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  14 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  15 +import th.co.ais.ssbsrfc.instance.OwnershipInfo;
  16 +import th.co.ais.ssbsrfc.instance.RequestHeader;
  17 +import th.co.ais.ssbsrfc.instance.SubAccessCode;
  18 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  19 +
  20 +
  21 +public class SubWaitChargeRequest extends WaitSubState {
  22 +
  23 + AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns();
  24 +
  25 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  26 + {
  27 + this._state = StateConfig.SSTATE_W_CHARGEREQUEST;
  28 + this._eventType = StateConfig.Incoming_ChargeRequest_Request;
  29 + this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;
  30 + if (equinoxRawData != null) {
  31 + ec02Instance.getAFInstance().setOrig(equinoxRawData.getOrig());
  32 + ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());
  33 + ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
  34 + }
  35 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);
  36 + }
  37 +
  38 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  39 + {
  40 + String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
  41 + AppLog.d("## PARAMETERS : " + value);
  42 +
  43 + this.type = Constant.TYPE_SUCCESS;
  44 +
  45 + RequestHeader requestHeader = new RequestHeader();
  46 + requestHeader.setVersion("1");
  47 + requestHeader.setBusinessCode("1");
  48 + requestHeader.setMessageSeq("20160429104931209");
  49 + OwnershipInfo ownershipInfo = new OwnershipInfo();
  50 + ownershipInfo.setBEID("101");
  51 + ownershipInfo.setBRID("101");
  52 + requestHeader.setOwnershipInfo(ownershipInfo);
  53 + AccessSecurity accessSecurity = new AccessSecurity();
  54 + accessSecurity.setLoginSystemCode("Xaysombath");
  55 + accessSecurity.setPassword("ATBoomuNQidKc8iYhPgx5A==");
  56 + requestHeader.setAccessSecurity(accessSecurity);
  57 + requestHeader.setAccessMode("3");
  58 +
  59 + AdjustmentRequest adjustmentrequest = new AdjustmentRequest();
  60 + adjustmentrequest.setAdjustmentSerialNo("20160429104632990");
  61 + AdjustmentObj adjustmentObj = new AdjustmentObj();
  62 + SubAccessCode subAccessCode = new SubAccessCode();
  63 + subAccessCode.setPrimaryIdentity("2055579910");
  64 + adjustmentObj.setSubAccessCode(subAccessCode);
  65 + adjustmentrequest.setAdjustmentObj(adjustmentObj);
  66 + adjustmentrequest.setOpType("1");
  67 + AdjustmentInfo adjustmentInfo = new AdjustmentInfo();
  68 + adjustmentInfo.setBalanceType("C_MAIN_ACCOUNT");
  69 + adjustmentInfo.setAdjustmentType("1");
  70 + adjustmentInfo.setAdjustmentAmt("1000");
  71 + adjustmentInfo.setCurrencyID("1049");
  72 + adjustmentrequest.setAdjustmentInfo(adjustmentInfo);
  73 +
  74 + adjustmentRequest.setRequestHeader(requestHeader);
  75 + adjustmentRequest.setAdjustmentRequest(adjustmentrequest);
  76 +
  77 + ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest);
  78 +
  79 + return value;
  80 +
  81 +
  82 +
  83 + }
  84 +
  85 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  86 + {
  87 +
  88 +
  89 +
  90 +
  91 + }
  92 +
  93 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  94 + {
  95 + switch (this.type) {
  96 + case Constant.TYPE_SUCCESS:
  97 + default:
  98 + {
  99 +// this.isStat = false;
  100 +// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));
  101 + String message = th.co.ais.ssbsrfc.message.MessageParser.toSoap(adjustmentRequest);
  102 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST);
  103 + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeRequest_Response,adjustmentRequest);
  104 +
  105 + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));
  106 + }
  107 + }
  108 + }
  109 +}
... ...
src/th/co/ais/ssbsrfc/substate/WaitSubState.java 0 → 100644
... ... @@ -0,0 +1,541 @@
  1 +package th.co.ais.ssbsrfc.substate;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +
  7 +import th.co.ais.ssbsrfc.config.Constant;
  8 +import th.co.ais.ssbsrfc.config.Invoke;
  9 +import th.co.ais.ssbsrfc.config.StateConfig;
  10 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  11 +import th.co.ais.ssbsrfc.instance.ListE01Data;
  12 +import th.co.ais.ssbsrfc.instance.LogError;
  13 +import th.co.ais.ssbsrfc.instance.ManageTime;
  14 +import th.co.ais.ssbsrfc.instance.ResIns;
  15 +import th.co.ais.ssbsrfc.interfaces.EQXMsg;
  16 +import th.co.ais.ssbsrfc.interfaces.IAFSubState;
  17 +import th.co.ais.ssbsrfc.message.EC02Builder;
  18 +import th.co.ais.ssbsrfc.message.MessageParser;
  19 +import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  20 +import th.co.ais.ssbsrfc.utils.Global;
  21 +import th.co.ais.ssbsrfc.utils.Log;
  22 +import ais.mmt.sand.comlog.DetailsLogPrototype;
  23 +import ais.mmt.sand.comlog.bean.DataBean;
  24 +import ais.mmt.sand.comlog.bean.DataBean.TYPE;
  25 +import ais.mmt.sand.comlog.exception.CommonLogException;
  26 +import ec02.af.abstracts.AbstractAF;
  27 +import ec02.af.data.EquinoxRawData;
  28 +import ec02.af.data.GlobalData;
  29 +import ec02.utils.AppLog;
  30 +
  31 +public class WaitSubState implements IAFSubState {
  32 +
  33 + protected int type = -1;
  34 + protected EC02Builder ec02Builder = new EC02Builder();
  35 + protected List<EquinoxRawData> equinoxRawDataList = new ArrayList<EquinoxRawData>();
  36 + protected int _stateType = Constant.SUBSTATE_TYPE_UNKNOWN;
  37 + protected String _state = "";
  38 + protected String _eventType = "";
  39 + protected Object _objIns = null;
  40 + protected String _resultCode = "null";
  41 + protected String _resultDescription = "null";
  42 + protected List<ResIns> _listResult = new ArrayList<ResIns>();
  43 + protected boolean isStat = true;
  44 + protected HashMap<String, Boolean> disRespone = new HashMap<String, Boolean>();
  45 + protected String _invokeTimeout = null;
  46 + protected boolean isRetry = false;
  47 + private boolean isIdle = true;
  48 +
  49 +
  50 + @Override
  51 + public List<EquinoxRawData> doActionSubState(AbstractAF abstractAF,
  52 + EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
  53 + this.isIdle = (ec02Instance.getAFInstance().getFlow() != 0) ? false : true;
  54 + configSubstate(ec02Instance, equinoxRawData);
  55 +
  56 + AppLog.d("#### FLOWMANAGER CURRENTFLOW: " + Global.getFlowName(ec02Instance.getAFInstance().getFlow()));
  57 +// try {
  58 + switch (this._stateType) {
  59 + case Constant.SUBSTATE_TYPE_W_REQUEST:
  60 + initRequest(abstractAF, ec02Instance, equinoxRawData);
  61 + break;
  62 + case Constant.SUBSTATE_TYPE_W_RESPONSE:
  63 + initResponse(abstractAF, ec02Instance, equinoxRawData);
  64 + break;
  65 + case Constant.SUBSTATE_TYPE_W_E01:
  66 + initE01(abstractAF, ec02Instance, equinoxRawData);
  67 + break;
  68 + case Constant.SUBSTATE_TYPE_UNKNOWN:
  69 + default:
  70 + break;
  71 + }
  72 +
  73 + if (this._invokeTimeout == null) {
  74 + this.summaryLog(ec02Instance, equinoxRawData);
  75 + }
  76 +// } catch (Exception e) {
  77 +// AppLog.d("## EXCEPTION(MESSAGE): " + e.getMessage());
  78 +// AppLog.d("## EXCEPTION(STACKTRACE): " + e.getStackTrace());
  79 +// AppLog.d("## EXCEPTION(E): " + e);
  80 +// ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  81 +// }
  82 + return this.equinoxRawDataList;
  83 + }
  84 +
  85 + protected void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  86 + { }
  87 +
  88 + protected boolean checkRejectApplication(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  89 + {
  90 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  91 + boolean bool = false;
  92 + if (!currentState.equals(_state) && !currentState.equals(StateConfig.SSTATE_END)) {
  93 + bool = true;
  94 + } else { // case is IDLE
  95 + if (currentState.equals(StateConfig.SSTATE_END))
  96 + {
  97 + boolean first = StateConfig.isFirstState(_state);
  98 + AppLog.d("State"+first);
  99 + if (!first) {
  100 + bool = true;
  101 + }
  102 + } else {
  103 + ec02Instance.getAFInstance().setCurrentState(_state);
  104 + }
  105 + }
  106 + return bool;
  107 + }
  108 +
  109 + protected void initRequest(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  110 + {
  111 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(START) ####]");
  112 + this.ec02Builder.setEquinoxRawData(equinoxRawData, abstractAF, ec02Instance);
  113 + Global.setEc02Builder(this.ec02Builder);
  114 +
  115 + if (equinoxRawData == null) { // TIMEOUT
  116 + ManageTime mt = new ManageTime(ec02Instance);
  117 + List<String> listTimeout = mt.getState();
  118 + for (String invoke : listTimeout) {
  119 + Invoke _iv = new Invoke(invoke);
  120 + String eventType = _iv.eventType;
  121 + String cmd = _iv.cmd;
  122 + this.timeout(abstractAF, ec02Instance, invoke, eventType, Constant.REQUEST.toLowerCase(), null);
  123 + String subState = StateConfig.getSubStateFromEventType(eventType);
  124 + // SET LOG
  125 + Log.results(ec02Instance, subState, this.equinoxRawDataList, this.type, cmd, this.isStat);
  126 + // summary for timeout
  127 + this._invokeTimeout = invoke;
  128 + this.summaryLog(ec02Instance, equinoxRawData);
  129 + }
  130 + } else {
  131 + // CHECK EVENT TYPE/ CURRENTSTATE
  132 + String eventType = equinoxRawData.getRawEventType();
  133 + ec02Instance.getAFInstance().listTimeoutRemoveForEventType(eventType);
  134 + if (eventType.equals(_eventType)) {
  135 + String ret = equinoxRawData.getRet();
  136 + Log.dev(" initRequest RET: " + ret);
  137 + AppLog.d("ret Value:"+ret);
  138 + if (ret.equals("4")) {
  139 + String invoke = equinoxRawData.getInvoke();
  140 + String messageType = equinoxRawData.getType();
  141 + String cmd = new Invoke(invoke).cmd;
  142 + Log.dev(" initRequest TIMEOUT: " + invoke + ":" + messageType + ":" + cmd);
  143 + this.timeout(abstractAF, ec02Instance, invoke, eventType, messageType, null);
  144 + // SET LOG
  145 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, cmd, this.isStat);
  146 + // summary for timeout
  147 + this._invokeTimeout = invoke;
  148 + this.summaryLog(ec02Instance, equinoxRawData);
  149 + } else {
  150 + // MAIN
  151 + this.action(abstractAF, ec02Instance, equinoxRawData);
  152 + // SET LOG
  153 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat);
  154 + }
  155 + } else {
  156 + this.rejectApplication(abstractAF, ec02Instance, equinoxRawData, this._objIns);
  157 + // SET LOG
  158 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat);
  159 + }
  160 + }
  161 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]");
  162 + AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState());
  163 + }
  164 +
  165 + protected void initResponse(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  166 + {
  167 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(START) ####]");
  168 + this.ec02Builder.setEquinoxRawData(equinoxRawData, abstractAF, ec02Instance);
  169 + Global.setEc02Builder(this.ec02Builder);
  170 +
  171 + if (equinoxRawData == null) { // TIMEOUT
  172 + ManageTime mt = new ManageTime(ec02Instance);
  173 + List<String> listTimeout = mt.getState();
  174 + List<EquinoxRawData> eqxTmpList = new ArrayList<EquinoxRawData>();
  175 + for (String invoke : listTimeout) {
  176 + String eventType = new Invoke(invoke).eventType;
  177 + String cmd = new Invoke(invoke).cmd;
  178 + this.timeout(abstractAF, ec02Instance, invoke, eventType, Constant.RESPONSE.toLowerCase(), null);
  179 + String subState = StateConfig.getSubStateFromEventType(eventType);
  180 + // SET LOG
  181 + for (EquinoxRawData eqxxRawlist : this.equinoxRawDataList) {
  182 + eqxTmpList.add(eqxxRawlist);
  183 + }
  184 + Log.results(ec02Instance, subState, this.equinoxRawDataList, this.type, cmd, this.isStat);
  185 + this.equinoxRawDataList = new ArrayList<EquinoxRawData>();
  186 + // summary for timeout
  187 + this._invokeTimeout = invoke;
  188 + this.summaryLog(ec02Instance, equinoxRawData);
  189 + }
  190 + this.equinoxRawDataList = eqxTmpList;
  191 + } else {
  192 + String eventType = equinoxRawData.getRawEventType();
  193 + if (eventType.equals(_eventType)) {
  194 + // CASE SUCCESS, ERROR, REJECT, ABORT, TIMEOUT
  195 + String invoke = equinoxRawData.getInvoke();
  196 + String messageType = equinoxRawData.getType();
  197 + String cmd = new Invoke(invoke).cmd;
  198 + // CHECK EVENT TYPE/ CURRENTSTATE
  199 + String ret = equinoxRawData.getRet();
  200 + if (ret.equals("1")) { // ERROR
  201 + this.error(abstractAF, ec02Instance, invoke, eventType, messageType, null);
  202 + } else if (ret.equals("2")) { // REJECT
  203 + this.reject(abstractAF, ec02Instance, invoke, eventType, messageType, null);
  204 + } else if (ret.equals("3")) { // ABORT
  205 + this.abort(abstractAF, ec02Instance, invoke, eventType, messageType, null);
  206 + } else if (ret.equals("4")) { // TIMEOUT
  207 + this.timeout(abstractAF, ec02Instance, invoke, eventType, messageType, null);
  208 + } else { // SUCCESS
  209 + this.action(abstractAF, ec02Instance, equinoxRawData);
  210 + }
  211 + // SET LOG
  212 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, cmd, this.isStat);
  213 + } else {
  214 + this.rejectApplication(abstractAF, ec02Instance, equinoxRawData, this._objIns);
  215 + // SET LOG
  216 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat);
  217 + }
  218 + }
  219 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]");
  220 + AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState());
  221 + }
  222 +
  223 + protected void initE01(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  224 + {
  225 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(START) ####]");
  226 + this.ec02Builder.setEquinoxRawData(equinoxRawData, abstractAF, ec02Instance);
  227 + Global.setEc02Builder(this.ec02Builder);
  228 +
  229 + GlobalData e01 = abstractAF.getUtils().getGlobalData();
  230 + if (e01.isRecieve()) {
  231 + String messageType = Constant.RESPONSE.toLowerCase();
  232 + String invoke = null;
  233 +// try {
  234 + int ret = e01.getGlobaldataMessageType().getCode();
  235 + if (ret == 1) { // ERROR
  236 + this.error(abstractAF, ec02Instance, invoke, this._eventType, messageType, e01);
  237 + } else if (ret == 2) { // REJECT
  238 + this.reject(abstractAF, ec02Instance, invoke, this._eventType, messageType, e01);
  239 + } else if (ret == 3) { // ABORT
  240 + this.abort(abstractAF, ec02Instance, invoke, this._eventType, messageType, e01);
  241 + } else if (ret == 4) { // TIMEOUT
  242 + this.timeout(abstractAF, ec02Instance, invoke, this._eventType, messageType, e01);
  243 + } else { // SUCCESS // REJECT APPICATION
  244 + if (e01.isRecieve()) {
  245 + invoke = e01.getTransactionId();
  246 + ec02Instance.getAFInstance().listTimeoutRemove(invoke);
  247 + EquinoxRawData eqxRawData = new EquinoxRawData();
  248 + ListE01Data ins = new ListE01Data(e01.getDataResultSet());
  249 + String rawData = MessageParser.toJson(ins);
  250 +// AppLog.d("E01 RAWDATA: " + rawData);
  251 + eqxRawData.getRawDataAttributes().put("val", rawData);
  252 + eqxRawData.setRawEventType(this._eventType);
  253 + eqxRawData.setRet("0");
  254 + eqxRawData.setInvoke(invoke);
  255 + eqxRawData.setCType(EQXMsg.TEXTPLAIN);
  256 + eqxRawData.setType(Constant.RESPONSE.toLowerCase());
  257 +
  258 + this.action(abstractAF, ec02Instance, eqxRawData);
  259 + }
  260 + }
  261 + // SET LOG
  262 + Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat);
  263 +// } catch (Exception e) {
  264 +// AppLog.e("## E01(GET RET):" + e.getMessage());
  265 +// }
  266 + }
  267 + else { // TIMEOUT
  268 + if (equinoxRawData == null) {
  269 + ManageTime mt = new ManageTime(ec02Instance);
  270 + List<String> listTimeout = mt.getState();
  271 + for (String invoke : listTimeout) {
  272 + String cmd = new Invoke(invoke).cmd;
  273 + String eventType = new Invoke(invoke).eventType;
  274 + this.timeout(abstractAF, ec02Instance, invoke, eventType, Constant.RESPONSE.toLowerCase(), null);
  275 + String subState = StateConfig.getSubStateFromEventType(eventType);
  276 + // SET LOG
  277 + Log.results(ec02Instance, subState, this.equinoxRawDataList, this.type, cmd, this.isStat);
  278 + // summary for timeout
  279 + this._invokeTimeout = invoke;
  280 + this.summaryLog(ec02Instance, equinoxRawData);
  281 + }
  282 + } else {
  283 + String ret = equinoxRawData.getRet();
  284 + String invoke = equinoxRawData.getInvoke();
  285 + String messageType = equinoxRawData.getType();
  286 + if (ret.equals("4")) { // TIMEOUT
  287 + String eventType = new Invoke(invoke).eventType;
  288 + this.timeout(abstractAF, ec02Instance, invoke, eventType, messageType, e01);
  289 + // SET LOG
  290 + Log.results(ec02Instance, _state, this.equinoxRawDataList, Constant.TYPE_TIMEOUT, this.isStat);
  291 + } else { // REJECT APPICATION
  292 + this.action(abstractAF, ec02Instance, equinoxRawData);
  293 + }
  294 + }
  295 + }
  296 +
  297 + AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]");
  298 + AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState());
  299 + }
  300 +
  301 + protected void action(AbstractAF abstractAF,EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  302 + {
  303 +// try {
  304 + this._objIns = this.getMessage(ec02Instance, equinoxRawData);
  305 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  306 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  307 +
  308 + boolean isReject = this.checkRejectApplication(ec02Instance, equinoxRawData);
  309 + if(isReject) {
  310 + this.rejectApplication(abstractAF, ec02Instance, equinoxRawData, this._objIns);
  311 + } else {
  312 + // set type
  313 + this.verifyMessage(abstractAF, ec02Instance, equinoxRawData);
  314 + if (this.type == Constant.TYPE_REJECT_APPLICATION) {
  315 + this.rejectApplication(abstractAF, ec02Instance, equinoxRawData, this._objIns);
  316 + } else {
  317 + //Detail Log Input
  318 + String value = EqxStringUtils.getMessage(equinoxRawData, null, false);
  319 + String invoke = equinoxRawData.getInvoke();
  320 + String eventType = equinoxRawData.getRawEventType();
  321 + String messageType = equinoxRawData.getType();
  322 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, this._objIns, value);
  323 +
  324 + this.buildMessage(abstractAF, ec02Instance, equinoxRawData);
  325 + }
  326 + }
  327 +// } catch (Exception e) {
  328 +// AppLog.e("## EXCEPTION(MESSAGE): " + e.getMessage());
  329 +// AppLog.e("## EXCEPTION(STACKTRACE): " + e.getStackTrace().toString());
  330 +// AppLog.e("## EXCEPTION(E): " + e.toString());
  331 +// AppLog.e("## GETMESSAGE EQUINOX: ERROR");
  332 +// AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  333 +// this.type = Constant.TYPE_INVALID;
  334 +//
  335 +// //Detail Log Input
  336 +// String value = EqxStringUtils.getMessage(equinoxRawData, null, false);
  337 +// String invoke = equinoxRawData.getInvoke();
  338 +// String eventType = equinoxRawData.getRawEventType();
  339 +// String messageType = equinoxRawData.getType();
  340 +// this.detailLogInput(ec02Instance, invoke, eventType, messageType, this._objIns, value);
  341 +//
  342 +// this.buildMessage(abstractAF, ec02Instance, equinoxRawData);
  343 +// }
  344 + }
  345 +
  346 + protected void rejectApplication(AbstractAF abstractAF,EC02Instance ec02Instance, EquinoxRawData equinoxRawData, Object ins)
  347 + {
  348 + AppLog.d("REJECTED BY APPLICATION");
  349 + this.type = Constant.TYPE_REJECT_APPLICATION;
  350 + String eventType = equinoxRawData.getRawEventType();
  351 + String currentState = ec02Instance.getAFInstance().getCurrentState();
  352 + String invoke = equinoxRawData.getInvoke();
  353 + String messageType = equinoxRawData.getType();
  354 + String value = EqxStringUtils.getMessage(equinoxRawData, null, false);
  355 + AppLog.d("REJECT [" + eventType + "]: IN [" + currentState + "]");
  356 + Global.setRejectByApplication(true);
  357 + ec02Instance.getAFInstance().getBackupSummary().backup(ec02Instance, equinoxRawData);
  358 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins, value);
  359 +
  360 + if (messageType.toLowerCase().equals(Constant.REQUEST.toLowerCase()) && equinoxRawData != null && !equinoxRawData.getRet().equals("1") && !equinoxRawData.getRet().equals("2") && !equinoxRawData.getRet().equals("3") && !equinoxRawData.getRet().equals("4")) {
  361 +// String to = equinoxRawData.getOrig();
  362 +// EQXRawInstance eqxRaw = SubMessages.getRawUnknownResponse(abstractAF, ec02Instance, to, invoke, eventType);
  363 +// this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  364 + }
  365 +
  366 + }
  367 +
  368 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  369 + {
  370 + return null;
  371 + }
  372 +
  373 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  374 + { }
  375 +
  376 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  377 + { }
  378 +
  379 + protected void error(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
  380 + {
  381 + AppLog.d("SPECIFIC ERROR BY APPLICATION");
  382 + this.type = Constant.TYPE_ERROR;
  383 + LogError ins = new LogError("1", "Error");
  384 + this._resultCode = "null";
  385 + this._resultDescription = "Error";
  386 + this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  387 + }
  388 +
  389 + protected void reject(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
  390 + {
  391 + AppLog.d("REJECTED BY PLATFORM");
  392 + this.type = Constant.TYPE_REJECT;
  393 + LogError ins = new LogError("2", "Reject");
  394 + this._resultCode = "null";
  395 + this._resultDescription = "Reject";
  396 + this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  397 + }
  398 +
  399 + protected void abort(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
  400 + {
  401 + AppLog.d("RETURN ABORTED BY PLATFORM");
  402 + this.type = Constant.TYPE_ABORT;
  403 + this._resultCode = "null";
  404 + LogError ins = new LogError("3", "Abort");
  405 + this._resultDescription = "Abort";
  406 + this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  407 + }
  408 +
  409 + protected void timeout(AbstractAF abstractAF, EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
  410 + {
  411 + AppLog.d("RETURN TIMEOUT BY PLATFORM");
  412 + this.type = Constant.TYPE_TIMEOUT;
  413 + this._resultCode = "null";
  414 + LogError ins = new LogError("4", "Timeout");
  415 + this._resultDescription = "Timeout";
  416 + this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  417 + }
  418 +
  419 + private void detailLogInput(EC02Instance ec02Instance,String invoke, String eventType, String messageType, Object ins)
  420 + {
  421 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins, null);
  422 + }
  423 +
  424 + protected void detailLogInput(EC02Instance ec02Instance,String invoke, String eventType, String messageType, Object ins, String rawData)
  425 + {
  426 + //Detail Log Input
  427 + if(invoke == null) {
  428 + invoke = "";
  429 + }
  430 +
  431 + String command = StateConfig.getCommandFromEventType(eventType);
  432 + String node = Global.getNodeFromEventType(eventType);
  433 + if (command != null && command.contains("|") && invoke.contains(".")) {
  434 + Invoke _iv = new Invoke(invoke);
  435 + command = _iv.cmd;
  436 + node = _iv.nodeName;
  437 + }
  438 +
  439 + //String event = node + "." + command;
  440 + String responseTime = ec02Instance.getAFInstance().getResponseTime();
  441 + if(this._stateType == Constant.SUBSTATE_TYPE_W_REQUEST) {
  442 + responseTime = null;
  443 + }
  444 +
  445 + DetailsLogPrototype detLog = ec02Instance.getAFInstance().getDetaillog();
  446 + DataBean input = new DataBean();
  447 + input.setInvoke(invoke);
  448 + input.setDirector(node);
  449 + input.setCommandName(command);
  450 +
  451 + if (!this.isIdle) {
  452 + try {
  453 + if (messageType != null && messageType.toLowerCase().equals(EQXMsg.REQUEST.toLowerCase())) {
  454 + input.setType(TYPE.REQ);
  455 + responseTime = null;
  456 + } else if (messageType != null && messageType.toLowerCase().equals(EQXMsg.RESPONSE.toLowerCase())) {
  457 + input.setType(TYPE.RES);
  458 + } else {
  459 + if (Log.debug) {
  460 + AppLog.d("## MessageType :" + messageType);
  461 + }
  462 + if(this._stateType == Constant.SUBSTATE_TYPE_W_REQUEST) {
  463 + input.setType(TYPE.REQ);
  464 + responseTime = null;
  465 + } else {
  466 + input.setType(TYPE.RES);
  467 + }
  468 + }
  469 + } catch (Exception e) {
  470 + if(this._stateType == Constant.SUBSTATE_TYPE_W_REQUEST) {
  471 + input.setType(TYPE.REQ);
  472 + } else {
  473 + input.setType(TYPE.RES);
  474 + }
  475 + }
  476 + } else {
  477 + if(this._stateType == Constant.SUBSTATE_TYPE_W_REQUEST) {
  478 + input.setType(TYPE.REQ);
  479 + responseTime = null;
  480 + } else {
  481 + input.setType(TYPE.RES);
  482 + }
  483 + }
  484 + input.setJsonData(MessageParser.toJsonObject(ins));
  485 + input.setRawData(Global.getDetailLogRawData(rawData));
  486 +
  487 + if(responseTime != null) {
  488 + input.setRespTime(Long.parseLong(responseTime));
  489 + }
  490 +
  491 + try {
  492 + detLog.addInput(input);
  493 + } catch (CommonLogException e) {
  494 + // TODO Auto-generated catch block
  495 + e.printStackTrace();
  496 + }
  497 + }
  498 +
  499 + private void buildResponeMsg(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, Object ins, GlobalData e01)
  500 + {
  501 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);
  502 + // set error code
  503 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  504 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  505 +// String subState = StateConfig.getSubStateFromEventType(eventType);
  506 +// LogError insError = (LogError)ins;
  507 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  508 + }
  509 +
  510 + private void summaryLog(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
  511 + {
  512 + try {
  513 + if ((this.type != Constant.TYPE_SUCCESS && this.type != -1 && this.type != Constant.TYPE_REJECT_APPLICATION && this.type != Constant.TYPE_SUCCESS_WITH_CONDITION && this.type != Constant.TYPE_FILE_NOT_FOUND && this.type != Constant.TYPE_DATA_EXISTED && this.type != Constant.TYPE_DATA_NOT_FOUND && this._resultCode != null && !this._resultCode.equals("20000") && !this.isRetry && !this._resultCode.equals("23")) || (this.type == Constant.TYPE_MISSING || this.type == Constant.TYPE_INVALID)) {
  514 + String command = StateConfig.getCommandFromEventType(this._eventType);
  515 + if (command.contains("|") && equinoxRawData != null && equinoxRawData.getInvoke() != null && equinoxRawData.getInvoke().contains(".")) {
  516 + String invoke = equinoxRawData.getInvoke();
  517 + command = new Invoke(invoke).cmd;
  518 + } else if (command.contains("|") && this._invokeTimeout != null && this._invokeTimeout.contains(".")) {
  519 + command = new Invoke(this._invokeTimeout).cmd;
  520 + }
  521 + if (this.type == Constant.TYPE_MISSING || this.type == Constant.TYPE_INVALID) {
  522 + this._resultCode = "null";
  523 + this._resultDescription = "Missing or invalid parameter";
  524 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  525 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  526 + }
  527 + String node = Global.getNodeFromEventType(this._eventType);
  528 + if (Log.debug) {
  529 + AppLog.d("## SUMMARY:" + this.type + node + command + this._resultCode + this._resultDescription);
  530 + }
  531 +
  532 + if(this._resultDescription.equals(EQXMsg.EMPTY)) {
  533 + this._resultDescription = "null";
  534 + }
  535 + ec02Instance.getAFInstance().getSumlog().addDestination(node, command, this._resultCode, this._resultDescription);
  536 + }
  537 + } catch (CommonLogException e) {
  538 + e.printStackTrace();
  539 + }
  540 + }
  541 +}
... ...
src/th/co/ais/ssbsrfc/utils/DateUtil.java 0 → 100644
... ... @@ -0,0 +1,2342 @@
  1 +package th.co.ais.ssbsrfc.utils;
  2 +
  3 +import java.sql.Timestamp;
  4 +import java.text.DateFormat;
  5 +import java.text.ParseException;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.ArrayList;
  8 +import java.util.Calendar;
  9 +import java.util.Collection;
  10 +import java.util.Date;
  11 +import java.util.GregorianCalendar;
  12 +import java.util.HashMap;
  13 +import java.util.Locale;
  14 +import java.util.Random;
  15 +import java.util.TimeZone;
  16 +
  17 +
  18 +
  19 +public class DateUtil {
  20 +
  21 + protected final static long ONEDAY = 10 * 10 * 10 * 24 * 60 * 60;
  22 + static long w_oneDay = (long) 1000.0 * 60 * 60 * 24;
  23 + static String vLocale_defined = "TH";
  24 + public static final String yyyyMMdd = "yyyy-MM-dd";
  25 + public static final String ddMMyyyy = "dd/MM/yyyy";
  26 + public static final String ddMMMMyyyy = "dd MMMM yyyy";
  27 + public static final String ddMMyyyyHHmiss = "dd MMMM yyyy HH:mm:ss";
  28 + public static final String yyyyMMddHHmiss = "yyyy-MM-dd HH:mm:ss";
  29 + public static final String ddMMyyyyHHmi = "dd MMMM yyyy HH:mm";
  30 +
  31 + public static Calendar getCurrentDateTime() {
  32 + Calendar cal = new GregorianCalendar();
  33 + return cal;
  34 + }
  35 +
  36 + public static String getDateExpiryTime(String startTime, int numDay) {
  37 +
  38 + String newCal = null;
  39 + java.util.Date date = null;
  40 + Calendar c;
  41 + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd:HHmmss");
  42 + try {
  43 + date = (Date)formatter.parse(startTime);
  44 + c = Calendar.getInstance();
  45 + c.setTime(date);
  46 + c.add(Calendar.DATE, numDay);
  47 + newCal = formatter.format(c.getTime());
  48 + } catch (ParseException e) {
  49 + // TODO Auto-generated catch block
  50 + e.printStackTrace();
  51 + }
  52 + return newCal;
  53 + }
  54 +
  55 + public static String getDateExpiryTimeZone(String startTime, int numDay) {
  56 +
  57 + String newCal = null;
  58 + java.util.Date date = null;
  59 + Calendar c;
  60 + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssZ");
  61 + try {
  62 + date = (Date)formatter.parse(startTime);
  63 + c = Calendar.getInstance();
  64 + c.setTime(date);
  65 + c.add(Calendar.DATE, numDay);
  66 + newCal = formatter.format(c.getTime());
  67 + } catch (ParseException e) {
  68 + // TODO Auto-generated catch block
  69 + e.printStackTrace();
  70 + }
  71 + return newCal;
  72 + }
  73 +
  74 + public static String getExpiryTime(String startTime, int sec) {
  75 + String datetime = null;
  76 + java.util.Date date = null;
  77 + Calendar c;
  78 + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd:HHmmss");
  79 + try {
  80 + date = (Date)formatter.parse(startTime);
  81 + c = Calendar.getInstance();
  82 + c.setTime(date);
  83 + c.add(Calendar.SECOND, sec);
  84 + //System.out.println("calendar"+c.getTime());
  85 + datetime = formatter.format(c.getTime());
  86 + } catch (ParseException e) {
  87 + // TODO Auto-generated catch block
  88 + e.printStackTrace();
  89 + }
  90 + return datetime;
  91 + }
  92 +
  93 + public static String getExpiryTimeZone(String startTime, int sec) {
  94 + String datetime = null;
  95 + java.util.Date date = null;
  96 + Calendar c;
  97 + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssZ");
  98 + try {
  99 + date = (Date)formatter.parse(startTime);
  100 + c = Calendar.getInstance();
  101 + c.setTime(date);
  102 + c.add(Calendar.SECOND, sec);
  103 + //System.out.println("calendar"+c.getTime());
  104 + datetime = formatter.format(c.getTime());
  105 + } catch (ParseException e) {
  106 + // TODO Auto-generated catch block
  107 + e.printStackTrace();
  108 + }
  109 + return datetime;
  110 + }
  111 +
  112 + /*public static String getDateExpiryTime(int numDay, int numMonth, int numYear) {
  113 +
  114 + String oldCal = null;
  115 + String newCal = null;
  116 + oldCal = getCurrentDateTime().get(Calendar.YEAR) + "/"
  117 + + (getCurrentDateTime().get(Calendar.MONTH)+1) + "/"
  118 + + getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + " "
  119 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  120 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  121 + + getCurrentDateTime().get(Calendar.SECOND);
  122 + SimpleDateFormat dfold = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  123 + Calendar c = Calendar.getInstance();
  124 +
  125 + try {
  126 + Date date = dfold.parse(oldCal);
  127 + c.setTime(date);
  128 + c.add(Calendar.DATE, numDay);
  129 + c.add(Calendar.MONTH, numMonth);
  130 + c.add(Calendar.YEAR, numYear);
  131 + SimpleDateFormat dfnew = new SimpleDateFormat("yyyyMMdd:HHmmss");
  132 + newCal = dfnew.format(c.getTime());
  133 +
  134 + } catch (ParseException e) {
  135 + // TODO Auto-generated catch block
  136 + e.printStackTrace();
  137 + }
  138 +
  139 + return newCal;
  140 + }*/
  141 +
  142 + public static String getDateTimeNow() {
  143 + String oldCal = null;
  144 + String newCal = null;
  145 + oldCal = getCurrentDateTime().get(Calendar.YEAR) + "/"
  146 + + (getCurrentDateTime().get(Calendar.MONTH)+1) + "/"
  147 + + getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + " "
  148 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  149 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  150 + + getCurrentDateTime().get(Calendar.SECOND);
  151 + SimpleDateFormat dfold = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  152 + try {
  153 + Date date = dfold.parse(oldCal);
  154 + SimpleDateFormat dfnew = new SimpleDateFormat("yyyyMMdd:HHmmss");
  155 + newCal = dfnew.format(date);
  156 +
  157 + } catch (ParseException e) {
  158 + // TODO Auto-generated catch block
  159 + e.printStackTrace();
  160 + }
  161 + return newCal;
  162 + }
  163 +
  164 + public static String getDateTimeZoneNow() {
  165 + String oldCal = null;
  166 + String newCal = null;
  167 + oldCal = getCurrentDateTime().get(Calendar.YEAR) + "/"
  168 + + (getCurrentDateTime().get(Calendar.MONTH)+1) + "/"
  169 + + getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + " "
  170 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  171 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  172 + + getCurrentDateTime().get(Calendar.SECOND);
  173 + SimpleDateFormat dfold = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  174 + try {
  175 + Date date = dfold.parse(oldCal);
  176 + SimpleDateFormat dfnew = new SimpleDateFormat("yyyyMMddHHmmssZ");
  177 + newCal = dfnew.format(date);
  178 +
  179 + } catch (ParseException e) {
  180 + // TODO Auto-generated catch block
  181 + e.printStackTrace();
  182 + }
  183 + return newCal;
  184 + }
  185 +
  186 + public static String getDateTimeNowForWriteFile() {
  187 + String oldCal = null;
  188 + String newCal = null;
  189 + oldCal = getCurrentDateTime().get(Calendar.YEAR) + "/"
  190 + + (getCurrentDateTime().get(Calendar.MONTH)+1) + "/"
  191 + + getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + " "
  192 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  193 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  194 + + getCurrentDateTime().get(Calendar.SECOND);
  195 + SimpleDateFormat dfold = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  196 + try {
  197 + Date date = dfold.parse(oldCal);
  198 + SimpleDateFormat dfnew = new SimpleDateFormat("yyyyMMdd|HHmm");
  199 + newCal = dfnew.format(date);
  200 +
  201 + } catch (ParseException e) {
  202 + // TODO Auto-generated catch block
  203 + e.printStackTrace();
  204 + }
  205 + return newCal;
  206 + }
  207 +
  208 + public static String getDateTimeNowYYYYMMdd() {
  209 + String oldCal = null;
  210 + String newCal = null;
  211 + oldCal = getCurrentDateTime().get(Calendar.YEAR) + "/"
  212 + + (getCurrentDateTime().get(Calendar.MONTH)+1) + "/"
  213 + + getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + " "
  214 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  215 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  216 + + getCurrentDateTime().get(Calendar.SECOND);
  217 + SimpleDateFormat dfold = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  218 + try {
  219 + Date date = dfold.parse(oldCal);
  220 + SimpleDateFormat dfnew = new SimpleDateFormat("yyyyMMdd");
  221 + newCal = dfnew.format(date);
  222 +
  223 + } catch (ParseException e) {
  224 + // TODO Auto-generated catch block
  225 + e.printStackTrace();
  226 + }
  227 + return newCal;
  228 + }
  229 +
  230 + public static String getDateTimeNow_ddMMyyyy_HHmmss() {
  231 +
  232 + String newCal = null;
  233 + newCal = getCurrentDateTime().get(Calendar.DAY_OF_MONTH) + "/"
  234 + + getMonthStr(getCurrentDateTime().get(Calendar.MONTH)) + "/"
  235 + + getCurrentDateTime().get(Calendar.YEAR) + " "
  236 + + getCurrentDateTime().get(Calendar.HOUR_OF_DAY) + ":"
  237 + + getCurrentDateTime().get(Calendar.MINUTE) + ":"
  238 + + getCurrentDateTime().get(Calendar.SECOND);
  239 + return newCal;
  240 + }
  241 +
  242 + public static int getCurrentDay() {
  243 + return getCurrentDateTime().get(Calendar.DAY_OF_MONTH);
  244 + }
  245 +
  246 + public static int getCurrentDayOfWeek() {
  247 + return getCurrentDateTime().get(Calendar.DAY_OF_WEEK);
  248 + }
  249 +
  250 + public static int getCurrentMonth() {
  251 + return getCurrentDateTime().get(Calendar.MONTH);
  252 + }
  253 +
  254 + public static int getCurrentYear() {
  255 + return getCurrentDateTime().get(Calendar.YEAR);
  256 + }
  257 +
  258 + public static int getCurrentHour() {
  259 + return getCurrentDateTime().get(Calendar.HOUR_OF_DAY);
  260 + }
  261 +
  262 + public static int getCurrentMinute() {
  263 + return getCurrentDateTime().get(Calendar.MINUTE);
  264 + }
  265 +
  266 +
  267 + public static int getCurrentSecond() {
  268 + return getCurrentDateTime().get(Calendar.SECOND);
  269 + }
  270 +
  271 + public synchronized static long getCurrentDateTimeinLong() {
  272 + Calendar cal = new GregorianCalendar();
  273 + return cal.getTime().getTime();
  274 + }
  275 +
  276 + /* getCurrentDateTime by pattern format */
  277 + public static String getStringSystemDateTime(String pattern) {
  278 + Calendar currentCalendar = DateUtil.getCurrentDateTime();
  279 + String systemDateTime = DateUtil.convertDateTime2String(
  280 + currentCalendar, pattern);
  281 + return systemDateTime;
  282 + }
  283 +
  284 + /* convert Calendar by pattern format */
  285 + public static String convertDateTime2String(Calendar calendar,
  286 + String pattern) {
  287 + String data = null;
  288 +
  289 + if (calendar != null) {
  290 + SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.US);
  291 + data = sdf.format(calendar.getTime());
  292 + }
  293 + return data;
  294 + }
  295 +
  296 + public static String convertDateTime2String(Calendar calendar,
  297 + String pattern, Locale local) {
  298 + String data = null;
  299 +
  300 + if (calendar != null) {
  301 + SimpleDateFormat sdf = new SimpleDateFormat(pattern, local);
  302 + data = sdf.format(calendar.getTime());
  303 + }
  304 +
  305 + return data;
  306 + }
  307 +
  308 + public static String convertDateTime2String(Date calendar, String pattern,
  309 + Locale local) {
  310 + String data = null;
  311 +
  312 + if (calendar != null) {
  313 + SimpleDateFormat sdf = new SimpleDateFormat(pattern, local);
  314 + data = sdf.format(calendar.getTime());
  315 + }
  316 +
  317 + return data;
  318 + }
  319 +
  320 + public static String convertDateTime2String(Timestamp calendar, String pattern,
  321 + Locale local) {
  322 + String data = null;
  323 +
  324 + if (calendar != null) {
  325 + SimpleDateFormat sdf = new SimpleDateFormat(pattern, local);
  326 + data = sdf.format(calendar.getTime());
  327 + }
  328 +
  329 + return data;
  330 + }
  331 +
  332 + public static Calendar getCalendar(long time) {
  333 + Calendar cal = new GregorianCalendar();
  334 + cal.setTime(new Date(time));
  335 +
  336 + return cal;
  337 + }
  338 +
  339 + public static Calendar getCalendar(int day, int month, int year) {
  340 + return getCalendar(day, month, year, 0, 0, 0);
  341 + }
  342 +
  343 + public static Calendar getCalendar(int day, int month, int year, int hour,
  344 + int minute) {
  345 + return getCalendar(day, month, year, hour, minute, 0);
  346 + }
  347 +
  348 + public static Calendar getCalendar(int day, int month, int year, int hour,
  349 + int minute, int second) {
  350 + Calendar cal = null;
  351 +
  352 + if (day >= 0 && month >= 0 && year >= 0 && hour >= 0 && minute >= 0) {
  353 + cal = new GregorianCalendar(Locale.US);
  354 + cal.set(Calendar.DAY_OF_MONTH, day);
  355 + cal.set(Calendar.MONTH, month);
  356 + cal.set(Calendar.YEAR, year);
  357 + cal.set(Calendar.HOUR_OF_DAY, hour);
  358 + cal.set(Calendar.MINUTE, minute);
  359 + cal.set(Calendar.SECOND, second);
  360 + cal.set(Calendar.MILLISECOND, 0);
  361 + }
  362 +
  363 + // cal.add(Calendar.HOUR_OF_DAY, plus);
  364 +
  365 + return cal;
  366 + }
  367 +
  368 + /**
  369 + * Convert from java.lang.Object to java.util.Date Creation date:
  370 + * (26/05/2004 11:00:00)
  371 + *
  372 + * @return java.util.Date
  373 + * @param theDateObj
  374 + * java.lang.Object
  375 + */
  376 + public static java.util.Date getDate(Object theDateObj) {
  377 + java.sql.Date w_TempDate;
  378 + if (theDateObj == null) {
  379 + w_TempDate = null;
  380 + } else {
  381 + java.util.Date theDateDate = (java.util.Date) theDateObj;
  382 + w_TempDate = new java.sql.Date(theDateDate.getTime());
  383 + }
  384 +
  385 + return w_TempDate;
  386 +
  387 + }
  388 +
  389 + /**
  390 + * Convert from java.lang.Object to java.util.Date. Creation date:
  391 + * (26/05/2004 11:00:00)
  392 + *
  393 + * @return java.util.Date
  394 + * @param theDateObj,theTimeObj
  395 + * java.lang.Object
  396 + */
  397 + public static java.util.Date getDate(Object theDateObj, Object theTimeObj) {
  398 + java.util.Date w_TempDate = null;
  399 + java.sql.Date w_ArgDate = null;
  400 + if (theDateObj != null) {
  401 + w_ArgDate = (java.sql.Date) theDateObj;
  402 + java.util.GregorianCalendar w_DateGregorian = new java.util.GregorianCalendar();
  403 + w_DateGregorian.setTime(w_ArgDate);
  404 +
  405 + if (theTimeObj != null) {
  406 +
  407 + java.util.GregorianCalendar w_TimeGregorian = new java.util.GregorianCalendar();
  408 + w_TimeGregorian.setTime((DateUtil.getDate(theTimeObj)));
  409 + w_DateGregorian.set(GregorianCalendar.HOUR_OF_DAY,
  410 + w_TimeGregorian.get(GregorianCalendar.HOUR_OF_DAY));
  411 + w_DateGregorian.set(GregorianCalendar.MINUTE, w_TimeGregorian
  412 + .get(GregorianCalendar.MINUTE));
  413 + w_DateGregorian.set(GregorianCalendar.SECOND, w_TimeGregorian
  414 + .get(GregorianCalendar.SECOND));
  415 +
  416 + w_TimeGregorian = null;
  417 + }
  418 +
  419 + w_TempDate = w_DateGregorian.getTime();
  420 + w_DateGregorian = null;
  421 + }
  422 +
  423 + w_ArgDate = null;
  424 +
  425 + return w_TempDate;
  426 +
  427 + }
  428 +
  429 + /** *************************************************************************** */
  430 + /**
  431 + * Convert from java.lang.String to java.util.Date. Creation date:
  432 + * (26/05/2004 11:30:03)
  433 + *
  434 + * @return java.lang.String
  435 + * @param theDateStr
  436 + * java.util.Date
  437 + */
  438 + /*public static java.util.Date getDate(String theDateStr) throws Exception {
  439 + Date w_TempDate = null;
  440 + Vector w_VecterDate = null;
  441 + String vLocale = null;
  442 + if (theDateStr != null && !theDateStr.trim().equals("")) {
  443 + w_VecterDate = StringUtil.getStringByDelimeter(theDateStr, "/");
  444 + java.util.GregorianCalendar w_TempGregorian = null;
  445 + vLocale = vLocale_defined;
  446 + if ("TH".equals(vLocale)) {
  447 + w_TempGregorian = new java.util.GregorianCalendar(
  448 + NumberUtil.getInt((String) w_VecterDate.elementAt(2)) - 543,
  449 + NumberUtil.getInt((String) w_VecterDate.elementAt(1)) - 1,
  450 + NumberUtil.getInt((String) w_VecterDate.elementAt(0)));
  451 + } else {
  452 + w_TempGregorian = new java.util.GregorianCalendar(NumberUtil
  453 + .getInt((String) w_VecterDate.elementAt(2)), NumberUtil
  454 + .getInt((String) w_VecterDate.elementAt(1)) - 1,
  455 + NumberUtil.getInt((String) w_VecterDate.elementAt(0)));
  456 + }
  457 +
  458 + w_TempDate = w_TempGregorian.getTime();
  459 + w_TempGregorian = null;
  460 +
  461 + }
  462 + w_VecterDate = null;
  463 +
  464 + return w_TempDate;
  465 + }
  466 +
  467 + public static java.util.Date getDateDelimerterByDash(String theDateStr)
  468 + throws Exception {
  469 + Date w_TempDate = null;
  470 + // Vector w_VecterDate = null;
  471 + String vLocale = null;
  472 + if (theDateStr != null && !theDateStr.trim().equals("")) {
  473 + // Vector w_Vecter = StringUtil.getStringByDelimeter(theDateStr,"
  474 + // ");
  475 + String[] tempSplit = theDateStr.split(" ");
  476 + Vector w_VecterDate = null;
  477 + w_VecterDate = StringUtil.getStringByDelimeter(tempSplit[0], "-");
  478 + Vector w_VecterTime = null;
  479 + try {
  480 + w_VecterTime = StringUtil.getStringByDelimeter(theDateStr
  481 + .split(" ")[1], ":");
  482 + } catch (Exception ex) {
  483 +
  484 + }
  485 + java.util.GregorianCalendar w_TempGregorian = null;
  486 + vLocale = vLocale_defined;
  487 + // if("TH".equals(vLocale)){
  488 + // w_TempGregorian = new
  489 + // java.util.GregorianCalendar(NumberUtil.getInt((String)w_VecterDate.elementAt(2))-543,NumberUtil.getInt((String)w_VecterDate.elementAt(1))
  490 + // - 1,NumberUtil.getInt((String)w_VecterDate.elementAt(0)));
  491 + // }else{
  492 + w_TempGregorian = new java.util.GregorianCalendar(NumberUtil
  493 + .getInt((String) w_VecterDate.elementAt(0)), NumberUtil
  494 + .getInt((String) w_VecterDate.elementAt(1)) - 1, NumberUtil
  495 + .getInt((String) w_VecterDate.elementAt(2)));
  496 + if (w_VecterTime != null) {
  497 + w_TempGregorian.set(NumberUtil.getInt((String) w_VecterDate
  498 + .elementAt(0)), NumberUtil.getInt((String) w_VecterDate
  499 + .elementAt(1)) - 1, NumberUtil
  500 + .getInt((String) w_VecterDate.elementAt(2)), NumberUtil
  501 + .getInt((String) w_VecterTime.elementAt(0)), NumberUtil
  502 + .getInt((String) w_VecterTime.elementAt(1)), NumberUtil
  503 + .getInt((String) w_VecterTime.elementAt(2)));
  504 + }
  505 + // }
  506 +
  507 + w_TempDate = w_TempGregorian.getTime();
  508 + w_TempGregorian = null;
  509 +
  510 + w_VecterDate = null;
  511 + w_VecterTime = null;
  512 + }
  513 +
  514 + return w_TempDate;
  515 + }*/
  516 +
  517 + /**
  518 + * Convert from java.lang.String to java.util.Date. Creation date:
  519 + * (11/05/2004 08:30:03)
  520 + *
  521 + * @return java.lang.String
  522 + * @param theDateStr,theTimeStr
  523 + * java.util.Date
  524 + */
  525 + /*public static java.util.Date getDate(String theDateStr, String theTimeStr)
  526 + throws Exception {
  527 + Date w_TempDate = null;
  528 + Vector w_DateVector = null;
  529 + Vector w_TimeVector = null;
  530 + int w_DateInt = 0, w_YearInt = 0, w_MonthInt = 0, w_MinutehInt = 0, w_HourInt = 0;
  531 + if (theDateStr != null) {
  532 + w_DateVector = StringUtil.getStringByDelimeter(theDateStr, "/");
  533 + w_YearInt = NumberUtil.getInt((String) w_DateVector.elementAt(2));
  534 + w_MonthInt = NumberUtil.getInt((String) w_DateVector.elementAt(1)) - 1;
  535 + w_DateInt = NumberUtil.getInt((String) w_DateVector.elementAt(0));
  536 + w_DateVector = null;
  537 + if (theTimeStr != null) {
  538 + w_TimeVector = StringUtil.getStringByDelimeter(theTimeStr, ":");
  539 + w_HourInt = NumberUtil.getInt((String) w_TimeVector
  540 + .elementAt(0));
  541 + w_MinutehInt = NumberUtil.getInt((String) w_TimeVector
  542 + .elementAt(1));
  543 + w_TimeVector = null;
  544 + }
  545 + java.util.GregorianCalendar w_TempGregorian = new java.util.GregorianCalendar(
  546 + w_YearInt, w_MonthInt, w_DateInt, w_HourInt, w_MinutehInt);
  547 + w_TempDate = w_TempGregorian.getTime();
  548 + w_TempGregorian = null;
  549 +
  550 + }
  551 + w_DateVector = null;
  552 + w_TimeVector = null;
  553 +
  554 + return w_TempDate;
  555 + }*/
  556 +
  557 + /**
  558 + * Convert from java.sql.Date and java.sql.Time to java.util.Date. Creation
  559 + * date: (26/05/2004 11:40:03)
  560 + *
  561 + * @return java.util.Date
  562 + * @param theDateDate
  563 + * java.sql.Date ,theTimeDate java.sql.Time
  564 + */
  565 + public static java.util.Date getDate(java.sql.Date theDateDate,
  566 + java.sql.Time theTimeDate) {
  567 + java.util.Date w_TempDate = null;
  568 + if (theDateDate == null) {
  569 + w_TempDate = null;
  570 + } else {
  571 + java.util.GregorianCalendar w_DateGregorian = new java.util.GregorianCalendar();
  572 +
  573 + w_DateGregorian.setTime(theDateDate);
  574 +
  575 + if (theTimeDate != null) {
  576 + java.util.GregorianCalendar w_TimeGregorian = new java.util.GregorianCalendar();
  577 + w_TimeGregorian.setTime((DateUtil.getDate(theTimeDate)));
  578 + w_DateGregorian.set(GregorianCalendar.HOUR_OF_DAY,
  579 + w_TimeGregorian.get(GregorianCalendar.HOUR_OF_DAY));
  580 + w_DateGregorian.set(GregorianCalendar.MINUTE, w_TimeGregorian
  581 + .get(GregorianCalendar.MINUTE));
  582 + w_DateGregorian.set(GregorianCalendar.SECOND, w_TimeGregorian
  583 + .get(GregorianCalendar.SECOND));
  584 + }
  585 + w_TempDate = w_DateGregorian.getTime();
  586 + w_DateGregorian = null;
  587 + }
  588 +
  589 + return w_TempDate;
  590 + }
  591 +
  592 + public static java.util.Date getTime(Object theDateObj) {
  593 + java.sql.Time w_TempDate;
  594 + if (theDateObj == null) {
  595 + w_TempDate = null;
  596 + } else {
  597 + java.util.Date theDateDate = (java.util.Date) theDateObj;
  598 + w_TempDate = new java.sql.Time(theDateDate.getTime());
  599 + }
  600 +
  601 + return w_TempDate;
  602 +
  603 + }
  604 +
  605 + @SuppressWarnings("unchecked")
  606 + public static Collection getWeekend(Calendar beginCal, Calendar endCal) {
  607 + Calendar begin = getCalendar(beginCal.get(Calendar.DAY_OF_MONTH),
  608 + beginCal.get(Calendar.MONTH), beginCal.get(Calendar.YEAR), 0,
  609 + 0, 0);
  610 + Calendar end = getCalendar(endCal.get(Calendar.DAY_OF_MONTH), endCal
  611 + .get(Calendar.MONTH), endCal.get(Calendar.YEAR), 0, 0, 0);
  612 +
  613 + int day = begin.get(Calendar.DAY_OF_WEEK);
  614 + Collection weekendCol = new ArrayList();
  615 + int nextSat = 6;
  616 +
  617 + if (day == Calendar.SUNDAY) {
  618 + weekendCol.add(getCalendar(begin.get(Calendar.DAY_OF_MONTH), begin
  619 + .get(Calendar.MONTH), begin.get(Calendar.YEAR)));
  620 + } else if (day == Calendar.SATURDAY) {
  621 + weekendCol.add(getCalendar(begin.get(Calendar.DAY_OF_MONTH), begin
  622 + .get(Calendar.MONTH), begin.get(Calendar.YEAR)));
  623 +
  624 + begin.add(Calendar.DAY_OF_MONTH, 1);
  625 +
  626 + if (begin.before(end) || begin.equals(end)) {
  627 + weekendCol.add(getCalendar(begin.get(Calendar.DAY_OF_MONTH),
  628 + begin.get(Calendar.MONTH), begin.get(Calendar.YEAR)));
  629 + }
  630 + } else {
  631 + nextSat = 7 - day;
  632 + }
  633 +
  634 + begin.add(Calendar.DAY_OF_MONTH, nextSat);
  635 +
  636 + for (; begin.before(end) || begin.equals(end); begin.add(
  637 + Calendar.DAY_OF_MONTH, 6)) {
  638 + weekendCol.add(getCalendar(begin.get(Calendar.DAY_OF_MONTH), begin
  639 + .get(Calendar.MONTH), begin.get(Calendar.YEAR)));
  640 +
  641 + begin.add(Calendar.DAY_OF_MONTH, 1);
  642 +
  643 + if (begin.before(end) || begin.equals(end)) {
  644 + weekendCol.add(getCalendar(begin.get(Calendar.DAY_OF_MONTH),
  645 + begin.get(Calendar.MONTH), begin.get(Calendar.YEAR)));
  646 + }
  647 + }
  648 +
  649 + return weekendCol;
  650 + }
  651 +
  652 + /**
  653 + * Insert the method's description here. Creation date: (11/3/2005 9:59:23)
  654 + *
  655 + * @return int
  656 + * @param d
  657 + * java.util.Date
  658 + */
  659 + public static Date getLastDateOfMonth(Date firstDateOfMonth) {
  660 +
  661 + Date newDate = null;
  662 + Date newDate2 = null;
  663 +
  664 + try {
  665 + newDate = addMonth(firstDateOfMonth, true, 1);
  666 + newDate2 = addDate(newDate, false, 1);
  667 +
  668 + } catch (Exception e) {
  669 + e.printStackTrace();
  670 + }
  671 +
  672 + return newDate2;
  673 + }
  674 +
  675 + /**
  676 + * Convert from java.util.Date to java.sql.Date. Creation date: (26/05/2004
  677 + * 13:00:03)
  678 + *
  679 + * @return java.sql.Date
  680 + * @param theDateDate
  681 + * java.util.Date
  682 + */
  683 + public static java.sql.Date getDBDate(java.util.Date theDateDate) {
  684 + java.sql.Date w_TempDate;
  685 + if (theDateDate == null)
  686 + w_TempDate = null;
  687 + else {
  688 + w_TempDate = new java.sql.Date(theDateDate.getTime());
  689 + }
  690 +
  691 + return w_TempDate;
  692 + }
  693 +
  694 + /**
  695 + * Convert from String to java.sql.Date. Creation date: (26/05/2004
  696 + * 13:00:03)
  697 + *
  698 + * @return java.sql.Date
  699 + * @param theDate
  700 + * String
  701 + */
  702 + public static java.sql.Date getDBDate(String theDate) throws Exception {
  703 + return getDBDate(getDate(theDate));
  704 + }
  705 +
  706 + /**
  707 + * Convert from Timestamp to java.sql.Date. Creation date: (26/05/2004
  708 + * 13:00:03)
  709 + *
  710 + * @return java.sql.Date
  711 + * @param theTimestamp
  712 + * Timestamp
  713 + */
  714 + public static java.sql.Date getDBDate(Timestamp theTimestamp)
  715 + throws Exception {
  716 + return getDBDate(new java.sql.Date(theTimestamp.getTime()));
  717 + }
  718 +
  719 + /*
  720 + * Format is DD/MM/YYYY:HH:MI 10/9/2005:08:00 // public static Calendar
  721 + * getCalendar(String calStr){
  722 + *
  723 + * StringTokenizer token = new StringTokenizer(calStr,"/"); String dd =
  724 + * token.nextToken(); String mm = token.nextToken(); String yy =
  725 + * token.nextToken(":").replace('/',' ').trim(); String hh =
  726 + * token.nextToken(":"); String mi = token.nextToken(":");
  727 + *
  728 + * return getCalendar(Integer.parseInt(dd),Integer.parseInt(mm),
  729 + * Integer.parseInt(yy),Integer.parseInt(hh),Integer.parseInt(mi)); }
  730 + */
  731 +
  732 + /*public static java.sql.Time getDBTime(String theTimeStr) throws Exception {
  733 + java.sql.Time w_time = null;
  734 + java.util.Vector w_TimeVector = null;
  735 + int w_HourInt = 0;
  736 + int w_MinuteInt = 0;
  737 + if (theTimeStr != null) {
  738 + w_TimeVector = StringUtil.getStringByDelimeter(theTimeStr, ":");
  739 + w_HourInt = NumberUtil.getInt((String) w_TimeVector.elementAt(0));
  740 + w_MinuteInt = NumberUtil.getInt((String) w_TimeVector.elementAt(1));
  741 + w_TimeVector = null;
  742 + }
  743 + java.util.GregorianCalendar w_TempGregorian = new java.util.GregorianCalendar(
  744 + 0, 0, 0, w_HourInt, w_MinuteInt);
  745 + w_time = new Time(w_TempGregorian.getTime().getTime());
  746 + return w_time;
  747 + }*/
  748 +
  749 + public static Timestamp getDBTimestamp(java.util.Date theDate)
  750 + throws Exception {
  751 + Timestamp w_timestamp = null;
  752 + if (theDate != null) {
  753 + w_timestamp = new Timestamp(theDate.getTime());
  754 + } else {
  755 + w_timestamp = new Timestamp(new java.util.Date().getTime());
  756 + }
  757 + return w_timestamp;
  758 + }
  759 +
  760 + /*public static Timestamp getDBTimestamp(Object theDate) throws Exception {
  761 + Timestamp w_timestamp = null;
  762 + if (theDate != null && !theDate.equals("")) {
  763 + w_timestamp = new Timestamp(
  764 + getDBDate(StringUtil.getString(theDate)).getTime());
  765 + } else {
  766 + w_timestamp = null;
  767 + }
  768 + return w_timestamp;
  769 + }*/
  770 +
  771 + /*
  772 + * public static HashMap getYearMonthDay(java.sql.Date theStartDate ,
  773 + * java.sql.Date theEndDate){ int w_start_day = theStartDate.getDate(); int
  774 + * w_start_month = theStartDate.getMonth()+1; int w_start_year =
  775 + * theStartDate.getYear()+1900; int w_end_day = theEndDate.getDate(); int
  776 + * w_end_month = theEndDate.getMonth()+1; int w_end_year =
  777 + * theEndDate.getYear()+1900; HashMap w_result = null; int w_year = 0 ; int
  778 + * w_month =0; int w_day = 0; int w_diff_year = 0; int w_diff_month = 0;
  779 + *
  780 + * w_diff_year = w_end_year - w_start_year; w_diff_month = w_end_month -
  781 + * w_start_month; switch(w_diff_year){
  782 + *
  783 + * case 0 : w_year = w_diff_year; w_month = w_diff_month -1; break; case 1 :
  784 + * w_year = w_diff_year - 1; w_month = w_end_month + (12 - w_start_month) -
  785 + * 1; break; default : w_year = w_diff_year - 1; w_month = w_end_month + (12 -
  786 + * w_start_month) - 1; break;
  787 + *
  788 + * }//switch(YEAR)
  789 + *
  790 + * switch(w_start_month){ case 1 : case 3 : case 5 : case 7 : case 8 : case
  791 + * 10 : case 12 : w_day = w_end_day + (31 - w_start_day)+ 1; if (w_day >
  792 + * 31){ w_month = w_month + 1; w_day = w_day - 31; }; break; case 2 : if
  793 + * ((w_start_year % 4) == 0) { w_day = w_end_day + (29 - w_start_day)+1; if
  794 + * (w_day > 29){ w_month = w_month + 1; w_day = w_day - 29; } }else{ w_day =
  795 + * w_end_day + (28-w_start_day)+1; if(w_day > 28){ w_month = w_month +1;
  796 + * w_day = w_day - 28; } };//end case 2: break;
  797 + *
  798 + * case 4 : case 6 : case 9 : case 11 : w_day = w_end_day + (30 -
  799 + * w_start_day) +1; if(w_day > 30){ w_month = w_month +1; w_day = w_day -
  800 + * 31; }; break; }//switch(START MONTH) switch(w_end_month){ case 1 : case 3 :
  801 + * case 5 : case 7 : case 8 : case 10 : case 12 : if(w_day == 31){ w_month =
  802 + * w_month + 1; w_day = 0; } break; case 2 : if ((w_start_year % 4) == 0) {
  803 + * if(w_day == 29){ w_month = w_month + 1; w_day = 0; } }else{ if((w_day ==
  804 + * 28) || (w_day == 29)){ w_month = w_month + 1; w_day = 0; } };//end case
  805 + * 2: break;
  806 + *
  807 + * case 4 : case 6 : case 9 : case 11 : if(w_day == 30){ w_month = w_month +
  808 + * 1; w_day = 0; } break; }//switch(STOP MONTH) if(w_month >= 24){ w_year =
  809 + * w_year + 2; w_month = w_month - 24; }else{ if(w_month >=12){ w_year =
  810 + * w_year + 1; w_month = w_month - 12; } }
  811 + *
  812 + * w_result = new HashMap();
  813 + * w_result.put("YEAR",NumberUtil.getInteger(w_year));
  814 + * w_result.put("MONTH",NumberUtil.getInteger(w_month));
  815 + * w_result.put("DAY",NumberUtil.getInteger(w_day)); return w_result;
  816 + * }//getYearMonthDay
  817 + */
  818 +
  819 + public static int getYear(Calendar cal) {
  820 + return cal.get(Calendar.YEAR);
  821 + }
  822 +
  823 + /**
  824 + * Insert the method's description here. Creation date: (16/8/2001 15:42:23)
  825 + *
  826 + * @return int
  827 + * @param d
  828 + * java.util.Date
  829 + */
  830 + public static int getYear(Date d) {
  831 + java.util.GregorianCalendar temp = new java.util.GregorianCalendar();
  832 + temp.setTime(d);
  833 + return temp.get(GregorianCalendar.YEAR);
  834 + }
  835 +
  836 + public static int getMonth(Calendar cal) {
  837 + return cal.get(Calendar.MONTH);
  838 + }
  839 +
  840 + /**
  841 + * Insert the method's description here. Creation date: (16/8/2001 15:42:23)
  842 + *
  843 + * @return int
  844 + * @param d
  845 + * java.util.Date
  846 + */
  847 + /*public static int getMonth(Date d) throws Exception {
  848 + String w_date = StringUtil.getLocaleDate(d);
  849 + java.util.Date w_d = DateUtil.getDate(w_date);
  850 + java.util.GregorianCalendar temp = new java.util.GregorianCalendar();
  851 + temp.setTime(w_d);
  852 + return temp.get(GregorianCalendar.MONTH) + 1;
  853 + }*/
  854 +
  855 + public static int getDay(Calendar cal) {
  856 + return cal.get(Calendar.DAY_OF_MONTH);
  857 + }
  858 +
  859 + public static int getDayOfWeek(Calendar cal) {
  860 + return cal.get(Calendar.DAY_OF_WEEK);
  861 + }
  862 +
  863 + public static int getDayOfYear(Timestamp theTimestamp) throws Exception {
  864 + int w_total_day = 0;
  865 + Date w_util_date = DateUtil.getDate(theTimestamp);
  866 + // GregorianCalendar w_gre_calendar = new GregorianCalendar();
  867 + w_total_day = getDayOfYear(w_util_date);
  868 + return w_total_day;
  869 + }
  870 +
  871 + public static int getDayOfYear(String theDate) throws Exception {
  872 + int w_total_day = 0;
  873 + Date w_util_date = DateUtil.getDate(theDate);
  874 + w_total_day = getDayOfYear(w_util_date);
  875 + return w_total_day;
  876 + }
  877 +
  878 + @SuppressWarnings("deprecation")
  879 + public static int getDayOfYear(Date theDate) throws Exception {
  880 + int w_total_day = 0;
  881 + GregorianCalendar w_gre_calendar = new GregorianCalendar();
  882 + if (w_gre_calendar.isLeapYear(theDate.getYear())) {
  883 + w_total_day = 366;
  884 + } else {
  885 + w_total_day = 365;
  886 + }
  887 + return w_total_day;
  888 + }
  889 +
  890 + public static int getHour(Calendar cal) {
  891 + return cal.get(Calendar.HOUR_OF_DAY);
  892 + }
  893 +
  894 + public static int getMinute(Calendar cal) {
  895 + return cal.get(Calendar.MINUTE);
  896 + }
  897 + public static int getSecond(Calendar cal) {
  898 + return cal.get(Calendar.SECOND);
  899 + }
  900 + public static void setDay(Calendar cal, int day) {
  901 + cal.set(Calendar.DAY_OF_MONTH, day);
  902 + }
  903 +
  904 + public static void setMonth(Calendar cal, int month) {
  905 + cal.set(Calendar.MONTH, month);
  906 + }
  907 +
  908 + public static void setYear(Calendar cal, int year) {
  909 + cal.set(Calendar.YEAR, year);
  910 + }
  911 +
  912 + public static void setHour(Calendar cal, int hour) {
  913 + cal.set(Calendar.HOUR_OF_DAY, hour);
  914 + }
  915 +
  916 + public static void setMinute(Calendar cal, int minute) {
  917 + cal.set(Calendar.MINUTE, minute);
  918 + }
  919 +
  920 + public static void setSecond(Calendar cal, int second) {
  921 + cal.set(Calendar.SECOND, second);
  922 + }
  923 +
  924 + public static void setMilli(Calendar cal, int milli) {
  925 + cal.set(Calendar.MILLISECOND, milli);
  926 + }
  927 +
  928 + public static boolean equal(Calendar cal1, Calendar cal2) {
  929 + Calendar c1 = getCalendar(cal1.get(Calendar.DAY_OF_MONTH), cal1
  930 + .get(Calendar.MONTH), cal1.get(Calendar.YEAR), cal1
  931 + .get(Calendar.HOUR), cal1.get(Calendar.MINUTE), cal1
  932 + .get(Calendar.SECOND));
  933 + Calendar c2 = getCalendar(cal2.get(Calendar.DAY_OF_MONTH), cal2
  934 + .get(Calendar.MONTH), cal2.get(Calendar.YEAR), cal2
  935 + .get(Calendar.HOUR), cal2.get(Calendar.MINUTE), cal2
  936 + .get(Calendar.SECOND));
  937 +
  938 + return c1.equals(c2);
  939 + }
  940 +
  941 + public static java.util.Date addDate(java.util.Date theDate, boolean add,
  942 + int amount) throws Exception {
  943 + if (theDate == null)
  944 + throw new Exception("theDate is null");
  945 + GregorianCalendar calendar = new GregorianCalendar();
  946 + calendar.setTime(theDate);
  947 + if (add)
  948 + calendar.add(GregorianCalendar.DATE, amount);
  949 + else
  950 + calendar.add(GregorianCalendar.DATE, (-1) * amount);
  951 +
  952 + return calendar.getTime();
  953 + }
  954 + public static java.util.Date addSecond(java.util.Date theDate,boolean add, int amount) throws Exception {
  955 + if(theDate == null)
  956 + throw new Exception ("theDate is null");
  957 + GregorianCalendar calendar = new GregorianCalendar();
  958 + calendar.setTime(theDate);
  959 + if(add)
  960 + calendar.add(GregorianCalendar.SECOND,amount);
  961 + else
  962 + calendar.add(GregorianCalendar.SECOND,(-1)*amount);
  963 +
  964 + return calendar.getTime();
  965 + }
  966 + public static java.util.Date addMonth(java.util.Date theDate, boolean add,
  967 + int amount) throws Exception {
  968 + if (theDate == null)
  969 + throw new Exception("theDate is null");
  970 + GregorianCalendar calendar = new GregorianCalendar();
  971 + calendar.setTime(theDate);
  972 + if (add)
  973 + calendar.add(GregorianCalendar.MONTH, amount);
  974 + else
  975 + calendar.add(GregorianCalendar.MONTH, (-1) * amount);
  976 +
  977 + return calendar.getTime();
  978 + }
  979 +
  980 + public static java.util.Date addYear(java.util.Date theDate, boolean add,
  981 + int amount) throws Exception {
  982 + if (theDate == null)
  983 + throw new Exception("theDate is null");
  984 + GregorianCalendar calendar = new GregorianCalendar();
  985 + calendar.setTime(theDate);
  986 + if (add)
  987 + calendar.add(GregorianCalendar.YEAR, amount);
  988 + else
  989 + calendar.add(GregorianCalendar.YEAR, (-1) * amount);
  990 +
  991 + return calendar.getTime();
  992 + }
  993 +
  994 + public static void addDay(Calendar cal, int i) {
  995 + cal.add(Calendar.DAY_OF_MONTH, i);
  996 + }
  997 +
  998 + public static void addHour(Calendar cal, int i) {
  999 + cal.add(Calendar.HOUR_OF_DAY, i);
  1000 + }
  1001 +
  1002 + public static void addMinute(Calendar cal, int i) {
  1003 + cal.add(Calendar.MINUTE, i);
  1004 + }
  1005 +
  1006 + // public static long diffDate(Calendar d1,Calendar d2) {
  1007 + // Calendar c1 = getCalendar(d1.get(Calendar.DAY_OF_MONTH),
  1008 + // d1.get(Calendar.MONTH), d1.get(Calendar.YEAR),0,0,0);
  1009 + // Calendar c2 = getCalendar(d2.get(Calendar.DAY_OF_MONTH),
  1010 + // d2.get(Calendar.MONTH), d2.get(Calendar.YEAR),0,0,0);
  1011 + // long diffInMilliSeconds=c1.getTime().getTime()-c2.getTime().getTime();
  1012 + // return diffInMilliSeconds/(1000*60*60*24);
  1013 + // }
  1014 + public static int diffDate(Calendar d1, Calendar d2) {
  1015 + Calendar c1 = getCalendar(d1.get(Calendar.DAY_OF_MONTH), d1
  1016 + .get(Calendar.MONTH), d1.get(Calendar.YEAR), 0, 0, 0);
  1017 + Calendar c2 = getCalendar(d2.get(Calendar.DAY_OF_MONTH), d2
  1018 + .get(Calendar.MONTH), d2.get(Calendar.YEAR), 0, 0, 0);
  1019 + long diffInMilliSeconds = c1.getTime().getTime()
  1020 + - c2.getTime().getTime();
  1021 + int diffDays = (int) (diffInMilliSeconds / (1000 * 60 * 60 * 24));
  1022 + return diffDays;
  1023 + }
  1024 +
  1025 + public static int diffDate(Date dateStart, Date dateEnd) throws Exception {
  1026 + Calendar calDateStart = new GregorianCalendar();
  1027 + calDateStart.set(Calendar.MONTH, dateStart.getMonth());
  1028 + calDateStart.set(Calendar.DATE, dateStart.getDate());
  1029 + calDateStart.set(Calendar.YEAR, dateStart.getYear());
  1030 + Calendar calDateEnd = new GregorianCalendar();
  1031 + calDateEnd.set(Calendar.MONTH, dateEnd.getMonth());
  1032 + calDateEnd.set(Calendar.DATE, dateEnd.getDate());
  1033 + calDateEnd.set(Calendar.YEAR, dateEnd.getYear());
  1034 + return diffDate(calDateStart, calDateEnd);
  1035 + }
  1036 +
  1037 + public static String diffDateStringThai(Date dateStart, Date dateEnd)
  1038 + throws Exception {
  1039 + String strDiffDateThai = "";
  1040 + int daysDiff = diffDate(dateStart, dateEnd);
  1041 + System.out.println("pass 764 - dateStart=" + dateStart.toString()
  1042 + + " dateEnd=" + dateEnd.toString());
  1043 + System.out.println("pass 764 - daysDiff=" + daysDiff);
  1044 + double dblYearsDiff = daysDiff / 365.25;
  1045 + int intYearsDiff = (int) (dblYearsDiff);
  1046 + double dblMonthDiff = (daysDiff % 365.25) / 30.4375;
  1047 + int intMonthDiff = (int) dblMonthDiff;
  1048 + double dblDayDiff = (daysDiff % 365.25) % 30.4375;
  1049 + int intDayDiff = (int) dblDayDiff;
  1050 +
  1051 + strDiffDateThai = intYearsDiff + " ปี " + intMonthDiff
  1052 + + " เดือน " + intDayDiff + " วัน ";
  1053 + return strDiffDateThai;
  1054 + }
  1055 +
  1056 + public static String diffDateStringEng(Date dateStart, Date dateEnd)
  1057 + throws Exception {
  1058 + String strDiffDateEng = "";
  1059 + int daysDiff = diffDate(dateStart, dateEnd);
  1060 + System.out.println("pass 764 - dateStart=" + dateStart.toString()
  1061 + + " dateEnd=" + dateEnd.toString());
  1062 + System.out.println("pass 764 - daysDiff=" + daysDiff);
  1063 + double dblYearsDiff = daysDiff / 365.25;
  1064 + int intYearsDiff = (int) (dblYearsDiff);
  1065 + double dblMonthDiff = (daysDiff % 365.25) / 30.4375;
  1066 + int intMonthDiff = (int) dblMonthDiff;
  1067 + double dblDayDiff = (daysDiff % 365.25) % 30.4375;
  1068 + int intDayDiff = (int) dblDayDiff;
  1069 + strDiffDateEng = intYearsDiff + " years " + intMonthDiff + " months "
  1070 + + intDayDiff + " days ";
  1071 + return strDiffDateEng;
  1072 + }
  1073 +
  1074 + //
  1075 + // public static int diffDate(Date d1, Date d2) throws Exception{
  1076 + // int diffDate = 0;
  1077 + // long diffLong = 0;
  1078 + // if(d1 != null && d2 != null){
  1079 + // java.util.GregorianCalendar x1= new java.util.GregorianCalendar();
  1080 + // x1.setTime(d1);
  1081 + // java.util.GregorianCalendar x2= new java.util.GregorianCalendar();
  1082 + // x2.setTime(d2);
  1083 + //
  1084 + // long dLong1 =
  1085 + // x1.getTime().getTime();//x1.UTC(x1.get(x1.YEAR),x1.get(x1.MONTH),x1.get(x1.DATE),x1.get(x1.HOUR_OF_DAY),x1.get(x1.MINUTE),x1.get(x1.SECOND));
  1086 + // long dLong2 =
  1087 + // x2.getTime().getTime();//x2.UTC(x2.get(x1.YEAR),x2.get(x1.MONTH),x2.get(x1.DATE),x2.get(x1.HOUR_OF_DAY),x2.get(x1.MINUTE),x2.get(x1.SECOND));
  1088 + // // if(dLong1>dLong2)
  1089 + // // diffLong = dLong1 - dLong2;
  1090 + // // else
  1091 + // diffLong = dLong2 - dLong1;
  1092 + //
  1093 + // diffLong = diffLong / ONEDAY;
  1094 + // diffDate = (int)diffLong;
  1095 + //
  1096 + // }else
  1097 + // throw new Exception("D1 or D2 is null");
  1098 + //
  1099 + // return diffDate;
  1100 + // }
  1101 +
  1102 + public static int diff(Date date1, Date date2) {
  1103 + Calendar c1 = Calendar.getInstance();
  1104 + Calendar c2 = Calendar.getInstance();
  1105 +
  1106 + c1.setTime(date1);
  1107 + c2.setTime(date2);
  1108 + int diffDay = 0;
  1109 +
  1110 + if (c1.before(c2)) {
  1111 + diffDay = countDiffDay(c1, c2);
  1112 + } else {
  1113 + diffDay = countDiffDay(c2, c1);
  1114 + }
  1115 +
  1116 + return diffDay;
  1117 + }
  1118 +
  1119 + public static int checkDatediff(Date date1, Date date2) {
  1120 + Calendar c1 = Calendar.getInstance();
  1121 + Calendar c2 = Calendar.getInstance();
  1122 +
  1123 + c1.setTime(date1);
  1124 + c2.setTime(date2);
  1125 + int diffDay = 0;
  1126 +
  1127 + if (c1.before(c2)) {
  1128 + diffDay = diffDate(c2, c1);
  1129 + } else {
  1130 + diffDay = 0;
  1131 + }
  1132 +
  1133 + return diffDay;
  1134 + }
  1135 +
  1136 + public static void DateDiff(Date date1, Date date2) {
  1137 + int diffDay = diff(date1, date2);
  1138 + System.out.println("Different Day : " + diffDay);
  1139 + }
  1140 +
  1141 + public static int countDiffDay(Calendar c1, Calendar c2) {
  1142 + int returnInt = 0;
  1143 + while (!c1.after(c2)) {
  1144 + c1.add(Calendar.DAY_OF_MONTH, 1);
  1145 + returnInt++;
  1146 + }
  1147 +
  1148 + if (returnInt > 0) {
  1149 + returnInt = returnInt - 1;
  1150 + }
  1151 +
  1152 + return (returnInt);
  1153 + }
  1154 + public static int countDiffDay(Date date1, Date date2) {
  1155 + Calendar c1 = Calendar.getInstance();
  1156 + Calendar c2 = Calendar.getInstance();
  1157 +
  1158 + c1.setTime(date1);
  1159 + c2.setTime(date2);
  1160 + int returnInt = 0;
  1161 + while (!c1.after(c2)) {
  1162 + c1.add(Calendar.DAY_OF_MONTH, 1);
  1163 + returnInt++;
  1164 + }
  1165 +
  1166 + if (returnInt > 0) {
  1167 + returnInt = returnInt - 1;
  1168 + }
  1169 +
  1170 + return (returnInt);
  1171 + }
  1172 +
  1173 + public static Date makeDate(String dateString) throws Exception {
  1174 + SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
  1175 + return formatter.parse(dateString);
  1176 + }
  1177 +
  1178 + public static Date makeDate(String dateString, String pattern)
  1179 + throws Exception {
  1180 + SimpleDateFormat formatter = new SimpleDateFormat(pattern);
  1181 + return formatter.parse(dateString);
  1182 + }
  1183 +
  1184 + public static String convertDateStringFormat(String dateStr,
  1185 + String formatDateFrom, String formatDateTo) {
  1186 + return convertDateStringFormat(dateStr, formatDateFrom, null,
  1187 + formatDateTo, null);
  1188 + }
  1189 +
  1190 + public static String convertDateStringFormat(String dateStr,
  1191 + String formatDateFrom, Locale localeFrom, String formatDateTo,
  1192 + Locale localeTO) {
  1193 + // System.out.println("convertDateStringFormat(dateStr<"+ dateStr
  1194 + // +">)");
  1195 + if (dateStr == null || "".equals(dateStr)) {
  1196 + return "";
  1197 + }
  1198 +
  1199 + String result = null;
  1200 + try {
  1201 +
  1202 + SimpleDateFormat dateFormatFrom = null;
  1203 + SimpleDateFormat dateFormatTO = null;
  1204 + if (localeFrom != null) {
  1205 + dateFormatFrom = new SimpleDateFormat(formatDateFrom,
  1206 + localeFrom);
  1207 + } else {
  1208 + dateFormatFrom = new SimpleDateFormat(formatDateFrom);
  1209 + }
  1210 + // dateFormat = new SimpleDateFormat(formatDateFrom);
  1211 + java.util.Date date = dateFormatFrom.parse(dateStr);
  1212 + if (localeTO != null) {
  1213 + dateFormatTO = new SimpleDateFormat(formatDateTo, localeTO);
  1214 + } else {
  1215 + dateFormatTO = new SimpleDateFormat(formatDateTo);
  1216 + }
  1217 + result = dateFormatTO.format(date);
  1218 + } catch (Exception e) {
  1219 + e.printStackTrace();
  1220 + result = dateStr;
  1221 + }
  1222 + return result;
  1223 + }
  1224 +
  1225 + public static String convertDateStringFormat(String dateStr, int diffDay,
  1226 + String formatDateFrom, Locale localeFrom, String formatDateTo,
  1227 + Locale localeTO) {
  1228 + // System.out.println("convertDateStringFormat(dateStr<"+ dateStr
  1229 + // +">)");
  1230 + if (dateStr == null || "".equals(dateStr)) {
  1231 + return "";
  1232 + }
  1233 +
  1234 + String result = null;
  1235 + try {
  1236 +
  1237 + SimpleDateFormat dateFormatFrom = null;
  1238 + SimpleDateFormat dateFormatTO = null;
  1239 + if (localeFrom != null) {
  1240 + dateFormatFrom = new SimpleDateFormat(formatDateFrom,
  1241 + localeFrom);
  1242 + } else {
  1243 + dateFormatFrom = new SimpleDateFormat(formatDateFrom);
  1244 + }
  1245 + // dateFormat = new SimpleDateFormat(formatDateFrom);
  1246 + java.util.Date date = dateFormatFrom.parse(dateStr);
  1247 + date.setDate(date.getDate() + diffDay);
  1248 + if (localeTO != null) {
  1249 + dateFormatTO = new SimpleDateFormat(formatDateTo, localeTO);
  1250 + } else {
  1251 + dateFormatTO = new SimpleDateFormat(formatDateTo);
  1252 + }
  1253 + result = dateFormatTO.format(date);
  1254 + } catch (Exception e) {
  1255 + e.printStackTrace();
  1256 + result = dateStr;
  1257 + }
  1258 + return result;
  1259 + }
  1260 +
  1261 + // public static void main(String argv[]) throws Exception {
  1262 + // Calendar cc1 = Calendar.getInstance();
  1263 + // Calendar cc2 = Calendar.getInstance();
  1264 + // cc1.add(Calendar.DAY_OF_MONTH, 10);
  1265 + //
  1266 + // DateDiff(cc1.getTime(), cc2.getTime());
  1267 + //
  1268 + // java.util.Date d1 = makeDate("10/10/2000");
  1269 + // java.util.Date d2 = makeDate("10/18/2000");
  1270 + // DateDiff(d1, d2);
  1271 + //
  1272 + // java.util.Date d3 = makeDate("1/1/2000");
  1273 + // java.util.Date d4 = makeDate("12/31/2000");
  1274 + // int diff34 = diff(d3, d4);
  1275 + // System.out.println("diff34=" + diff34);
  1276 + // }
  1277 +
  1278 + public static int diffMinute(Calendar first, Calendar last) {
  1279 + Calendar fCal = DateUtil.getCalendar(DateUtil.getDay(first), DateUtil
  1280 + .getMonth(first), DateUtil.getYear(first), DateUtil
  1281 + .getHour(first), DateUtil.getMinute(first), 0);
  1282 + Calendar lCal = DateUtil.getCalendar(DateUtil.getDay(last), DateUtil
  1283 + .getMonth(last), DateUtil.getYear(last),
  1284 + DateUtil.getHour(last), DateUtil.getMinute(last), 0);
  1285 +
  1286 + long lastLong = lCal.getTime().getTime();
  1287 + long firstLong = fCal.getTime().getTime();
  1288 +
  1289 + long diff = lastLong - firstLong;
  1290 +
  1291 + return (new Long(diff / (60 * 1000))).intValue();
  1292 + }
  1293 +
  1294 + public static long diffTimestamp(String first, String last) {
  1295 + long firstParsedDate = Long.parseLong(first);
  1296 + long secondParsedDate = Long.parseLong(last);
  1297 + long diff = secondParsedDate - firstParsedDate;
  1298 + return diff;
  1299 + }
  1300 +
  1301 + public static long diffSecond(String first, String last) throws ParseException {
  1302 + DateFormat formatter = new SimpleDateFormat("yyyyMMdd:HHmmss");
  1303 + Date dateFist = formatter.parse(first);
  1304 + Date dateLast = formatter.parse(last);
  1305 + Calendar strF_Cal = Calendar.getInstance();
  1306 + Calendar strL_Cal = Calendar.getInstance();
  1307 + strF_Cal.setTime(dateFist);
  1308 + strL_Cal.setTime(dateLast);
  1309 + Calendar fCal = DateUtil.getCalendar(DateUtil.getDay(strF_Cal), DateUtil
  1310 + .getMonth(strF_Cal), DateUtil.getYear(strF_Cal), DateUtil
  1311 + .getHour(strF_Cal), DateUtil.getMinute(strF_Cal), DateUtil.getSecond(strF_Cal));
  1312 + Calendar lCal = DateUtil.getCalendar(DateUtil.getDay(strL_Cal), DateUtil
  1313 + .getMonth(strL_Cal), DateUtil.getYear(strL_Cal),
  1314 + DateUtil.getHour(strL_Cal), DateUtil.getMinute(strL_Cal), DateUtil.getSecond(strL_Cal));
  1315 +
  1316 + long lastLong = lCal.getTime().getTime();
  1317 + long firstLong = fCal.getTime().getTime();
  1318 +
  1319 + long diff = lastLong - firstLong;
  1320 +
  1321 + return (new Long(diff / 1000));
  1322 + }
  1323 +
  1324 + public static java.sql.Date getYesterday(java.sql.Date theDate) {
  1325 + return diffTomorrowYesterday(theDate, true);
  1326 + }
  1327 +
  1328 + public static java.sql.Date getTomorrow(java.sql.Date theDate) {
  1329 + return diffTomorrowYesterday(theDate, false);
  1330 + }
  1331 +
  1332 + private static java.sql.Date diffTomorrowYesterday(java.sql.Date theDate,
  1333 + boolean theYesterday) {
  1334 + java.sql.Date w_tmpDate = null;
  1335 +
  1336 + if (theYesterday) {
  1337 + w_tmpDate = new java.sql.Date(theDate.getTime() - w_oneDay);
  1338 + } else {
  1339 + w_tmpDate = new java.sql.Date(theDate.getTime() + w_oneDay);
  1340 + }
  1341 +
  1342 + return w_tmpDate;
  1343 + }
  1344 +
  1345 + public static java.util.Date getPreviousOrNextByDayCount(
  1346 + java.util.Date oldDate, int dayCount) {
  1347 + java.util.Date newDate = null;
  1348 + newDate = new java.util.Date(oldDate.getTime() + (w_oneDay * dayCount));
  1349 + return newDate;
  1350 + }
  1351 +
  1352 + public static String convertDateFormatString(java.util.Date oldDate,
  1353 + String format, Locale locale) {
  1354 + String newDate = "";
  1355 + SimpleDateFormat formatter;
  1356 + formatter = new SimpleDateFormat(format, locale);
  1357 + newDate = formatter.format(oldDate);
  1358 + return newDate;
  1359 + }
  1360 +
  1361 + public static String convertDateFormatString(java.util.Date oldDate,
  1362 + int diffDay, String format, Locale locale) {
  1363 + String newDate = "";
  1364 + SimpleDateFormat formatter;
  1365 + formatter = new SimpleDateFormat(format, locale);
  1366 + oldDate.setDate(oldDate.getDate() + diffDay);
  1367 + newDate = formatter.format(oldDate);
  1368 + return newDate;
  1369 + }
  1370 +
  1371 + /*--------------------------------*/
  1372 + /* @author surasc45 - 25 Feb 2009 */
  1373 + /* Creation for : EBill Project */
  1374 + /*--------------------------------*/
  1375 + public synchronized static long getCurrentTime() {
  1376 + return Calendar.getInstance(new Locale("en", "US")).getTime().getTime();
  1377 + }
  1378 +
  1379 + public static java.sql.Date getCurrentDate() {
  1380 + return new java.sql.Date(getCurrentTime());
  1381 + }
  1382 +
  1383 + public static java.sql.Timestamp getCurrentTimestamp() {
  1384 + return new java.sql.Timestamp(getCurrentTime());
  1385 + }
  1386 +
  1387 + public static String convertTimestampToThaiDateString(
  1388 + java.sql.Timestamp inputDate, String pattern) {
  1389 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, new Locale(
  1390 + "th", "TH"));
  1391 + String dateStr = formatter.format(inputDate);
  1392 + return dateStr;
  1393 + }
  1394 +
  1395 + public static String convertTimestampToDateString(
  1396 + java.sql.Timestamp inputDate, String pattern) {
  1397 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, new Locale(
  1398 + "en", "US"));
  1399 + String dateStr = "";
  1400 + try {
  1401 + dateStr = formatter.format(inputDate);
  1402 + // System.out.println("dateStr : "+ dateStr);
  1403 + } catch (Exception ex) {
  1404 + ex.printStackTrace();
  1405 + }
  1406 + return dateStr;
  1407 + }
  1408 +
  1409 + public static String convertDateToThaiDateString(java.sql.Date inputDate,
  1410 + String pattern) {
  1411 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, new Locale(
  1412 + "th", "TH"));
  1413 + String dateStr = formatter.format(inputDate);
  1414 + return dateStr;
  1415 + }
  1416 +
  1417 + public static String convertDateToDateString(java.sql.Date inputDate,
  1418 + String pattern) {
  1419 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, new Locale(
  1420 + "en", "US"));
  1421 + String dateStr = "";
  1422 + try {
  1423 + dateStr = formatter.format(inputDate);
  1424 + } catch (Exception ex) {
  1425 + ex.printStackTrace();
  1426 + }
  1427 + return dateStr;
  1428 + }
  1429 +
  1430 + public static java.sql.Timestamp stringToTimeStamp(String datestr,
  1431 + String pattern) {
  1432 + return stringToTimeStamp(datestr, pattern, new Locale("en", "US"));
  1433 + }
  1434 +
  1435 + public static java.sql.Timestamp stringToTimeStamp(String datestr,
  1436 + String pattern, Locale locale) {
  1437 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  1438 + java.util.Date tmpdate = null;
  1439 + java.sql.Timestamp outdate = null;
  1440 + try {
  1441 + tmpdate = formatter.parse(datestr);
  1442 + outdate = new Timestamp(tmpdate.getTime());
  1443 + } catch (Exception e) {
  1444 + System.out.println("Cannot parse String \"" + datestr
  1445 + + "\" to TimeStamp object");
  1446 + }
  1447 + return outdate;
  1448 + }
  1449 +
  1450 + public static java.sql.Date stringToDate(String datestr, String pattern) {
  1451 + return stringToDate(datestr, pattern, new Locale("en", "US"));
  1452 + }
  1453 +
  1454 + public static java.sql.Date stringToDate(String datestr, String pattern,
  1455 + Locale locale) {
  1456 + SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  1457 + java.util.Date tmpdate = null;
  1458 + java.sql.Date outdate = null;
  1459 + try {
  1460 + tmpdate = formatter.parse(datestr);
  1461 + outdate = new java.sql.Date(tmpdate.getTime());
  1462 + } catch (Exception e) {
  1463 + System.out.println("Cannot parse String \"" + datestr
  1464 + + "\" to Date object");
  1465 + }
  1466 + return outdate;
  1467 + }
  1468 +
  1469 + public static String formatThaiDate(String dateStr, String patternIn,
  1470 + String patternOut) {
  1471 + String result = "";
  1472 + try {
  1473 + SimpleDateFormat defDateF = new SimpleDateFormat(patternIn,
  1474 + new Locale("th", "TH"));
  1475 + java.util.Date date = null;
  1476 + if (dateStr.equals("")) {
  1477 + date = new java.util.Date();
  1478 + } else {
  1479 + date = defDateF.parse(dateStr);
  1480 + }
  1481 + defDateF = new SimpleDateFormat(patternOut, new Locale("th", "TH"));
  1482 + result = defDateF.format(date);
  1483 + } catch (Exception e) {
  1484 + System.out
  1485 + .println("formatThaiDate with locale : get format date/datetime error.");
  1486 + e.printStackTrace();
  1487 + }
  1488 + return result;
  1489 + }
  1490 +
  1491 + public static String formatEngDate(String dateStr, String patternIn,
  1492 + String patternOut) {
  1493 + String result = "";
  1494 + try {
  1495 + SimpleDateFormat defDateF = new SimpleDateFormat(patternIn,
  1496 + new Locale("en", "US"));
  1497 + java.util.Date date = null;
  1498 + if (dateStr.equals("")) {
  1499 + date = new java.util.Date();
  1500 + } else {
  1501 + date = defDateF.parse(dateStr);
  1502 + }
  1503 + defDateF = new SimpleDateFormat(patternOut, new Locale("en", "US"));
  1504 + result = defDateF.format(date);
  1505 + } catch (Exception e) {
  1506 + System.out
  1507 + .println("formatEngDate with locale : get format date/datetime error.");
  1508 + e.printStackTrace();
  1509 + }
  1510 + return result;
  1511 + }
  1512 +
  1513 + public static String formatDate(String dateStr, Locale localeIn,
  1514 + Locale localeOut) {
  1515 + String result = "";
  1516 + try {
  1517 + SimpleDateFormat defDateF = new SimpleDateFormat("dd/MM/yyyy",
  1518 + localeIn);
  1519 + java.util.Date date = null;
  1520 + if (dateStr.equals("")) {
  1521 + date = new java.util.Date();
  1522 + } else {
  1523 + date = defDateF.parse(dateStr);
  1524 + }
  1525 + defDateF = new SimpleDateFormat("dd/MM/yyyy", localeOut);
  1526 + result = defDateF.format(date);
  1527 + } catch (Exception e) {
  1528 + System.out
  1529 + .println("formatDate with locale : get format date/datetime error.");
  1530 + e.printStackTrace();
  1531 + }
  1532 + return result;
  1533 + }
  1534 +
  1535 + public static String formatDateThai(String dateStr, String formatDate,
  1536 + Locale localeIn, Locale localeOut) {
  1537 + String result = "";
  1538 + try {
  1539 + SimpleDateFormat defDateF = new SimpleDateFormat(formatDate,
  1540 + localeIn);
  1541 + java.util.Date date = null;
  1542 + if (dateStr.equals("")) {
  1543 + date = new java.util.Date();
  1544 + } else {
  1545 + date = defDateF.parse(dateStr);
  1546 + }
  1547 + defDateF = new SimpleDateFormat(formatDate, localeOut);
  1548 + result = defDateF.format(date);
  1549 + } catch (Exception e) {
  1550 + System.out
  1551 + .println("formatDate with locale : get format date/datetime error.");
  1552 + e.printStackTrace();
  1553 + }
  1554 + return result;
  1555 + }
  1556 +
  1557 + public static String getMonthThai(int monthNumber) {
  1558 + String monthNameTH = "";
  1559 + switch (monthNumber) {
  1560 + case 1:
  1561 + monthNameTH = "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21";
  1562 + break;
  1563 + case 2:
  1564 + monthNameTH = "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C";
  1565 + break;
  1566 + case 3:
  1567 + monthNameTH = "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21";
  1568 + break;
  1569 + case 4:
  1570 + monthNameTH = "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19";
  1571 + break;
  1572 + case 5:
  1573 + monthNameTH = "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21";
  1574 + break;
  1575 + case 6:
  1576 + monthNameTH = "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19";
  1577 + break;
  1578 + case 7:
  1579 + monthNameTH = "\u0E01\u0E23\u0E01\u0E0F\u0E32\u0E04\u0E21";
  1580 + break;
  1581 + case 8:
  1582 + monthNameTH = "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21";
  1583 + break;
  1584 + case 9:
  1585 + monthNameTH = "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19";
  1586 + break;
  1587 + case 10:
  1588 + monthNameTH = "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21";
  1589 + break;
  1590 + case 11:
  1591 + monthNameTH = "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19";
  1592 + break;
  1593 + case 12:
  1594 + monthNameTH = "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21";
  1595 + break;
  1596 + }
  1597 + return monthNameTH;
  1598 + }
  1599 +
  1600 + public static String getMonthEng(int monthNumber) {
  1601 + String monthNameEN = "";
  1602 + switch (monthNumber) {
  1603 + case 1:
  1604 + monthNameEN = "January";
  1605 + break;
  1606 + case 2:
  1607 + monthNameEN = "February";
  1608 + break;
  1609 + case 3:
  1610 + monthNameEN = "March";
  1611 + break;
  1612 + case 4:
  1613 + monthNameEN = "April";
  1614 + break;
  1615 + case 5:
  1616 + monthNameEN = "May";
  1617 + break;
  1618 + case 6:
  1619 + monthNameEN = "June";
  1620 + break;
  1621 + case 7:
  1622 + monthNameEN = "July";
  1623 + break;
  1624 + case 8:
  1625 + monthNameEN = "August";
  1626 + break;
  1627 + case 9:
  1628 + monthNameEN = "September";
  1629 + break;
  1630 + case 10:
  1631 + monthNameEN = "October";
  1632 + break;
  1633 + case 11:
  1634 + monthNameEN = "November";
  1635 + break;
  1636 + case 12:
  1637 + monthNameEN = "December";
  1638 + break;
  1639 + }
  1640 + return monthNameEN;
  1641 + }
  1642 +
  1643 + // format "strDate" : mm/dd/yy
  1644 + public static String dateThai(String strDate) {
  1645 + String[] date = strDate.split("/");
  1646 + if (date[0].charAt(0) == '0') {
  1647 + date[0] = date[0].replaceFirst("0", "");
  1648 + }
  1649 + if (date[1].charAt(0) == '0') {
  1650 + date[1] = date[1].replaceFirst("0", "");
  1651 + }
  1652 + return date[1] + " " + getMonthThai(Integer.parseInt(date[0].trim()))
  1653 + + " " + date[2].trim();
  1654 + }
  1655 +
  1656 + // format "strDate" : mm/dd/yy
  1657 + public static String dateThaiWithThaiYear(String strDate) {
  1658 + String[] date = strDate.split("/");
  1659 + if (date[0].charAt(0) == '0') {
  1660 + date[0] = date[0].replaceFirst("0", "");
  1661 + }
  1662 + if (date[1].charAt(0) == '0') {
  1663 + date[1] = date[1].replaceFirst("0", "");
  1664 + }
  1665 + return date[1] + " " + getMonthThai(Integer.parseInt(date[0].trim()))
  1666 + + " " + (Integer.parseInt(date[2].trim()) + 543);
  1667 + }
  1668 +
  1669 + // format "strDate" : mm/dd/yy
  1670 + public static String dateEng(String strDate) {
  1671 + String[] date = strDate.split("/");
  1672 + if (date[0].charAt(0) == '0') {
  1673 + date[0] = date[0].replaceFirst("0", "");
  1674 + }
  1675 + if (date[1].charAt(0) == '0') {
  1676 + date[1] = date[1].replaceFirst("0", "");
  1677 + }
  1678 + return date[1] + " " + getMonthEng(Integer.parseInt(date[0].trim()))
  1679 + + " " + date[2].trim();
  1680 + }
  1681 +
  1682 + // format "strDateTime" : 2009-06-04 18:31:22.0
  1683 + public static String getDateTimeThai(String strDateTime) {
  1684 + String strDateTimeThai = "";
  1685 + if (strDateTime.trim() != "") {
  1686 + String[] arrayDateTimeThai = strDateTime.split(" ");
  1687 + String[] arrayDateThai = arrayDateTimeThai[0].split("-");
  1688 + String[] arrayTimeThai = null;
  1689 + if (arrayDateTimeThai.length > 1) {
  1690 + arrayTimeThai = arrayDateTimeThai[1].split(":");
  1691 + }
  1692 + strDateTimeThai = arrayDateThai[2].trim()
  1693 + + " "
  1694 + + DateUtil.getMonthThai(Integer.parseInt(arrayDateThai[1]
  1695 + .trim())) + " "
  1696 + + (Integer.parseInt(arrayDateThai[0].trim()) + 543);
  1697 + if (arrayTimeThai != null) {
  1698 + strDateTimeThai += " " + arrayTimeThai[0].trim() + ":"
  1699 + + arrayTimeThai[1].trim();
  1700 + }
  1701 + }
  1702 + return strDateTimeThai;
  1703 + }
  1704 +
  1705 + // format "strDateTime" : 31/05/2019 14:27:57
  1706 + public static String getDateTimeThai(String strDateTime, String token) {
  1707 + String strDateTimeThai = "";
  1708 + if (strDateTime.trim() != "") {
  1709 + String[] arrayDateTimeThai = strDateTime.split(" ");
  1710 + String[] arrayDateThai = arrayDateTimeThai[0].split(token);
  1711 + strDateTimeThai = arrayDateThai[0].trim()
  1712 + + " "
  1713 + + DateUtil.getMonthThai(Integer.parseInt(arrayDateThai[1]
  1714 + .trim())) + " "
  1715 + + (Integer.parseInt(arrayDateThai[2].trim()) + 543);
  1716 + strDateTimeThai += " " + arrayDateTimeThai[1];
  1717 + }
  1718 + return strDateTimeThai;
  1719 + }
  1720 +
  1721 + // format "strDateTime" : 31/05/2019 14:27:57
  1722 + public static String getDateTimeEng(String strDateTime, String token) {
  1723 + String strDateTimeEng = "";
  1724 + if (strDateTime.trim() != "") {
  1725 + String[] arrayDateTimeEng = strDateTime.split(" ");
  1726 + String[] arrayDateThai = arrayDateTimeEng[0].split(token);
  1727 + strDateTimeEng = arrayDateThai[0].trim()
  1728 + + " "
  1729 + + DateUtil.getMonthEng(Integer.parseInt(arrayDateThai[1]
  1730 + .trim())) + " "
  1731 + + (Integer.parseInt(arrayDateThai[2].trim()));
  1732 + strDateTimeEng += " " + arrayDateTimeEng[1];
  1733 + }
  1734 + return strDateTimeEng;
  1735 + }
  1736 +
  1737 + // format "strDateTime" : 2009-06-04 18:31:22.0
  1738 + public static String getDateTimeEng(String strDateTime) {
  1739 + String strDateTimeEng = "";
  1740 + if (strDateTime.trim() != "") {
  1741 + String[] arrayDateTimeEng = strDateTime.split(" ");
  1742 + String[] arrayDateEng = arrayDateTimeEng[0].split("-");
  1743 + String[] arrayTimeEng = null;
  1744 + if (arrayDateTimeEng.length > 1) {
  1745 + arrayTimeEng = arrayDateTimeEng[1].split(":");
  1746 + }
  1747 + strDateTimeEng = arrayDateEng[2].trim()
  1748 + + " "
  1749 + + DateUtil.getMonthEng(Integer.parseInt(arrayDateEng[1]
  1750 + .trim())) + " "
  1751 + + (Integer.parseInt(arrayDateEng[0].trim()));
  1752 + if (arrayTimeEng != null) {
  1753 + strDateTimeEng += " " + arrayTimeEng[0].trim() + ":"
  1754 + + arrayTimeEng[1].trim();
  1755 + }
  1756 +
  1757 + }
  1758 + return strDateTimeEng;
  1759 + }
  1760 +
  1761 + // format "strDateTime" : 2009-06-04 18:31:22.0
  1762 +
  1763 + /**
  1764 + * @param strDateTime
  1765 + * 2009-06-04 18:31:22.0
  1766 + * @return 04/06/2009 18:31:22
  1767 + */
  1768 + public static String getDateTimeString(String strDateTime) {
  1769 + String strDateTimeEng = "";
  1770 + if (strDateTime.trim() != "") {
  1771 + String[] arrayDateTimeEng = strDateTime.split(" ");
  1772 + String[] arrayDateEng = arrayDateTimeEng[0].split("-");
  1773 + String[] arrayTimeEng = null;
  1774 + if (arrayDateTimeEng.length > 1) {
  1775 + arrayTimeEng = arrayDateTimeEng[1].split(":");
  1776 + }
  1777 + strDateTimeEng = arrayDateEng[2].trim() + "/"
  1778 + + arrayDateEng[1].trim() + "/"
  1779 + + (Integer.parseInt(arrayDateEng[0].trim()));
  1780 + if (arrayTimeEng != null) {
  1781 + strDateTimeEng += " " + arrayTimeEng[0].trim() + ":"
  1782 + + arrayTimeEng[1].trim();
  1783 + }
  1784 +
  1785 + }
  1786 + return strDateTimeEng;
  1787 + }
  1788 +
  1789 +
  1790 +
  1791 +
  1792 +
  1793 +
  1794 + public static Calendar getCalendar(Locale locale) {
  1795 + Calendar cal = Calendar.getInstance(locale);
  1796 + cal.setTimeZone(TimeZone.getTimeZone("GMT+07:00"));
  1797 + return cal;
  1798 + }
  1799 +
  1800 + public static Calendar getSimpleDate(String strDate,String simpleDateFormat, Locale locale) {
  1801 + Calendar calendar = null;
  1802 + if (strDate != null && strDate.trim().length() > 0) {
  1803 + try {
  1804 + calendar = getCalendar(Locale.US);
  1805 + calendar.setTime(new SimpleDateFormat(simpleDateFormat, locale).parse(strDate));
  1806 + } catch (Exception e) {
  1807 + calendar = null;
  1808 + }
  1809 + }
  1810 + return calendar;
  1811 + }
  1812 + public static int getCustomerAge(String birthDate,String pattern,String locale) {
  1813 + return getCustomerAge(birthDate,pattern,new Locale(locale));
  1814 + }
  1815 +
  1816 + public static int getCustomerAge(String birthDate,String pattern,Locale locale) {
  1817 +
  1818 +
  1819 + Calendar dob = getSimpleDate(birthDate, pattern, locale);
  1820 + Calendar now = Calendar.getInstance(locale);
  1821 +
  1822 +
  1823 + if (dob.after(now)) {
  1824 + throw new IllegalArgumentException("Can't be born in the future");
  1825 + }
  1826 + int year1 = now.get(Calendar.YEAR);
  1827 + int year2 = dob.get(Calendar.YEAR);
  1828 + int age = year1 - year2;
  1829 + int month1 = now.get(Calendar.MONTH);
  1830 + int month2 = dob.get(Calendar.MONTH);
  1831 + if (month2 > month1) {
  1832 + age--;
  1833 + } else if (month1 == month2) {
  1834 + int day1 = now.get(Calendar.DAY_OF_MONTH);
  1835 + int day2 = dob.get(Calendar.DAY_OF_MONTH);
  1836 + if (day2 > day1) {
  1837 + age--;
  1838 + }
  1839 + }
  1840 +
  1841 + return age;
  1842 + }
  1843 +
  1844 +
  1845 +
  1846 + public static String mappingMonth(HashMap monthMap, String date) {
  1847 + String result = "";
  1848 + try {
  1849 + if (date != null && !"".equals(date)) {
  1850 + String month = date.substring(3, 6);
  1851 + // System.out.println("sub month : "+ month);
  1852 + result = date.replaceAll(month, String.valueOf(monthMap
  1853 + .get(month)));
  1854 + // System.out.println("replace month to : "+ result);
  1855 + } else {
  1856 + return "";
  1857 + }
  1858 + } catch (Exception e) {
  1859 + e.printStackTrace();
  1860 + result = date;
  1861 + }
  1862 + return result;
  1863 + }
  1864 +
  1865 + public static HashMap getMonthHashMap() {
  1866 + HashMap monthMap = new HashMap();
  1867 + monthMap.put("JAN", "01");
  1868 + monthMap.put("FEB", "02");
  1869 + monthMap.put("MAR", "03");
  1870 + monthMap.put("APR", "04");
  1871 + monthMap.put("MAY", "05");
  1872 + monthMap.put("JUN", "06");
  1873 + monthMap.put("JUL", "07");
  1874 + monthMap.put("AUG", "08");
  1875 + monthMap.put("SEP", "09");
  1876 + monthMap.put("OCT", "10");
  1877 + monthMap.put("NOV", "11");
  1878 + monthMap.put("DEC", "12");
  1879 +
  1880 + return monthMap;
  1881 + }
  1882 +
  1883 + public static String getMonthStr(int calendarMonth) {
  1884 +
  1885 + String rtnMonth = "";
  1886 +
  1887 + switch (calendarMonth) {
  1888 + case 0: rtnMonth = "01";
  1889 + break;
  1890 + case 1: rtnMonth = "02";
  1891 + break;
  1892 + case 2: rtnMonth = "03";
  1893 + break;
  1894 + case 3: rtnMonth = "04";
  1895 + break;
  1896 + case 4: rtnMonth = "05";
  1897 + break;
  1898 + case 5: rtnMonth = "06";
  1899 + break;
  1900 + case 6: rtnMonth = "07";
  1901 + break;
  1902 + case 7: rtnMonth = "08";
  1903 + break;
  1904 + case 8: rtnMonth = "09";
  1905 + break;
  1906 + case 9: rtnMonth = "10";
  1907 + break;
  1908 + case 10:rtnMonth = "11";
  1909 + break;
  1910 + case 11:rtnMonth = "12";
  1911 + break;
  1912 + default:
  1913 + rtnMonth = "01";
  1914 + break;
  1915 + }
  1916 +
  1917 + return rtnMonth;
  1918 + }
  1919 +
  1920 + public static String getFirstDay(Date d) throws Exception {
  1921 + Calendar calendar = new GregorianCalendar(Locale.US);
  1922 + calendar.setTime(d);
  1923 + calendar.set(Calendar.DAY_OF_MONTH, 1);
  1924 + Date dddd = calendar.getTime();
  1925 + SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
  1926 + return sdf1.format(dddd);
  1927 + }
  1928 +
  1929 + public static Calendar getLastDay(Date d) throws Exception {
  1930 + Calendar calendar = new GregorianCalendar(Locale.US);
  1931 + calendar.setTime(d);
  1932 + calendar.set(Calendar.DAY_OF_MONTH, calendar
  1933 + .getActualMaximum(Calendar.DAY_OF_MONTH));
  1934 + // Date dddd = calendar.getInstance();
  1935 +
  1936 + return calendar;
  1937 + }
  1938 +
  1939 + public static String getMonthEng_Abbreviations(String month) {
  1940 + String monthNameEN = "";
  1941 +
  1942 + if (month.equals("JAN")) {
  1943 + monthNameEN = "01";
  1944 + } else if (month.equals("FEB")) {
  1945 + monthNameEN = "02";
  1946 + } else if (month.equals("MAR")) {
  1947 + monthNameEN = "03";
  1948 + } else if (month.equals("APR")) {
  1949 + monthNameEN = "04";
  1950 + } else if (month.equals("MAY")) {
  1951 + monthNameEN = "05";
  1952 + } else if (month.equals("JUN")) {
  1953 + monthNameEN = "06";
  1954 + } else if (month.equals("JUL")) {
  1955 + monthNameEN = "07";
  1956 + } else if (month.equals("AUG")) {
  1957 + monthNameEN = "08";
  1958 + } else if (month.equals("SEP")) {
  1959 + monthNameEN = "09";
  1960 + } else if (month.equals("OCT")) {
  1961 + monthNameEN = "10";
  1962 + } else if (month.equals("NOV")) {
  1963 + monthNameEN = "11";
  1964 + } else if (month.equals("DEC")) {
  1965 + monthNameEN = "12";
  1966 + }
  1967 +
  1968 + return monthNameEN;
  1969 + }
  1970 +
  1971 + /*
  1972 + * #tom
  1973 + *
  1974 + * gen TransactionId
  1975 + */
  1976 + public static String getSONbr()
  1977 + {
  1978 + DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
  1979 + //get current date time with Calendar()
  1980 + Calendar cal = Calendar.getInstance();
  1981 + int randomNum1 = new Random().nextInt((1000000 - 100000) + 1) + 100000;
  1982 + int randomNum2 = new Random().nextInt((1000000 - 100000) + 1) + 100000;
  1983 + int randomNum3 = new Random().nextInt((10000 - 1000) + 1) + 1000;
  1984 + String output = dateFormat.format(cal.getTime()) + randomNum1 + randomNum2 + randomNum3;
  1985 +// System.out.println(output);
  1986 + return output;
  1987 + }
  1988 +
  1989 +
  1990 + /**
  1991 + *
  1992 + * @param dateStr
  1993 + * format MM/DD/YYYY HH:MM:SS
  1994 + * @return
  1995 + */
  1996 + public static Calendar getCalendar(String dateStr) {
  1997 + // DateFormat format = DateFormat.getInstance("MM/DD/YYYY HH:MM:SS");
  1998 + Calendar calendar = null;
  1999 + try {
  2000 + SimpleDateFormat format = new SimpleDateFormat(
  2001 + "MM/dd/yyyy HH:mm:ss", Locale.US);
  2002 + calendar = Calendar.getInstance();
  2003 +
  2004 + calendar.setTime(format.parse(dateStr));
  2005 + } catch (ParseException e) {
  2006 + // TODO Auto-generated catch block
  2007 + e.printStackTrace();
  2008 + }
  2009 + return calendar;
  2010 + }
  2011 +
  2012 +
  2013 + public static String dateTimeThaiddMMNoTime(String strDate){
  2014 + Date tempDate = DateUtil.stringToDate(strDate, "dd/MM/yyyy");
  2015 + String[] tempSplit = strDate.split(" ");
  2016 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2017 + String strFullDate = tempDate.getDate() + " " + getMonthThai(tempDate.getMonth()+1) + " " + (tempDate.getYear() +2443);
  2018 + return strFullDate;
  2019 + }
  2020 + public static String dateTimeEngddMMNoTime(String strDate){
  2021 + Date tempDate = DateUtil.stringToDate(strDate, "dd/MM/yyyy");
  2022 + String[] tempSplit = strDate.split(" ");
  2023 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2024 + String strFullDate = tempDate.getDate() + " " + getMonthEng(tempDate.getMonth()+1) + " " + (tempDate.getYear() +1900);
  2025 + return strFullDate;
  2026 + }
  2027 + public static String dateTimeThaiddMM(String strDate){
  2028 + Date tempDate = DateUtil.stringToDate(strDate, "dd/MM/yyyy");
  2029 + String[] tempSplit = strDate.split(" ");
  2030 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2031 + String strFullDate = tempDate.getDate() + " " + getMonthThai(tempDate.getMonth()+1) + " " + (tempDate.getYear() +2443) + " " + tempTime;
  2032 + return strFullDate;
  2033 + }
  2034 +
  2035 + public static String dateTimeEngddMM(String strDate){
  2036 + Date tempDate = DateUtil.stringToDate(strDate, "dd/MM/yyyy");
  2037 + String[] tempSplit = strDate.split(" ");
  2038 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2039 + String strFullDate = tempDate.getDate() + " " + getMonthEng(tempDate.getMonth()+1) + " " + (tempDate.getYear() +1900) + " " + tempTime;
  2040 + return strFullDate;
  2041 + }
  2042 + public static String checkWithIn3MonthsAgo(){
  2043 + Timestamp startTime = DateUtil.getCurrentTimestamp();
  2044 + String curDate = DateUtil.convertTimestampToDateString(startTime, "dd/MM/yyyy");
  2045 + String[] arrCurDate = curDate.split("/");
  2046 + // String[] arrCurDate = "02/01/2012".split("/");
  2047 + String result = "";
  2048 + String tempMonth = "";
  2049 + for(int i = 0; i < 4; i++){
  2050 + if((Integer.parseInt(arrCurDate[1])-i) > 0){ // this year
  2051 + tempMonth = (Integer.parseInt(arrCurDate[1])-i)+"";
  2052 + if(tempMonth.length() == 1){
  2053 + tempMonth = "0" + tempMonth;
  2054 + }
  2055 + result += (tempMonth+"/") + (arrCurDate[2]+"|");
  2056 + }else{ // last year
  2057 + if((Integer.parseInt(arrCurDate[1])-i) == 0){
  2058 + result += 12+"/";
  2059 + }else if((Integer.parseInt(arrCurDate[1])-i) == -1){
  2060 + result += 11+"/";
  2061 + }else if((Integer.parseInt(arrCurDate[1])-i) == -2){
  2062 + result += 10+"/";
  2063 + }else if((Integer.parseInt(arrCurDate[1])-i) == -3){
  2064 + result += "0"+9+"/";
  2065 + }
  2066 + result += ((Integer.parseInt(arrCurDate[2])-1)+"|");
  2067 + }
  2068 + }
  2069 + return result;
  2070 + }
  2071 + public static String dateWithThaiYear2(String strDate){
  2072 + String[] temp = strDate.split("/");
  2073 + if(temp[0].length() == 1){
  2074 + temp[0] = "0" + temp[0];
  2075 + }
  2076 + if(temp[1].length() == 1){
  2077 + temp[1] = "0" + temp[1];
  2078 + }
  2079 + return temp[0].trim() + "/" + temp[1].trim() + "/" + (Integer.parseInt(temp[2].trim()) +543);
  2080 + }
  2081 + public static String getDateTimeThaiContractSFF(String strDateTime){
  2082 + String strDateTimeThai = "";
  2083 + System.out.println("lerk strDateTime = "+strDateTime);
  2084 + if (strDateTime.trim() != ""){
  2085 +
  2086 + String[] arrayDateThai = strDateTime.split("/");
  2087 + if(arrayDateThai.length == 3){
  2088 +
  2089 + System.out.println("Length of arrayDateThai = 3");
  2090 + String Year = arrayDateThai[2].substring(0,4);
  2091 + System.out.println("lerk Year = "+Year);
  2092 + strDateTimeThai = arrayDateThai[0].trim() + " " + DateUtil.getMonthThai(Integer.parseInt(arrayDateThai[1].trim())) + " " + (Integer.parseInt(Year.trim())+543) ;
  2093 + System.out.println("strDateTimeThai = "+strDateTimeThai);
  2094 + }
  2095 + else
  2096 + {
  2097 + System.out.println("But Length of arrayDateThai = "+arrayDateThai.length);
  2098 +
  2099 + }
  2100 + }
  2101 + return strDateTimeThai;
  2102 + }
  2103 +
  2104 +
  2105 +
  2106 +// dd/MM/yyyy
  2107 + public static String getDateTimeEngContractSFF(String strDateTime){
  2108 + String strDateTimeEng = "";
  2109 + if (strDateTime.trim() != ""){
  2110 + String[] arrayDateEng = strDateTime.split("/");
  2111 +
  2112 + if(arrayDateEng.length == 3){
  2113 + System.out.println("Length of arrayDateEng = 3");
  2114 + String Year = arrayDateEng[2].substring(0,4);
  2115 + strDateTimeEng = arrayDateEng[0].trim() + " " + DateUtil.getMonthEng(Integer.parseInt(arrayDateEng[1].trim())) + " " + (Integer.parseInt(Year.trim()));
  2116 + }
  2117 + else
  2118 + {
  2119 + System.out.println("But Length of arrayDateEng = "+arrayDateEng.length);
  2120 +
  2121 + }
  2122 + }
  2123 + return strDateTimeEng;
  2124 + }
  2125 +
  2126 + public static String convertStringDateTimeToStringFormat(String date){
  2127 + String dateDt="";
  2128 + try{
  2129 + DateFormat formatter;
  2130 + Date dateNew;
  2131 + formatter=new SimpleDateFormat("ddMMyyyy HH:mm:ss",new Locale("en","US"));
  2132 + dateNew=(Date)formatter.parse(date);
  2133 + formatter=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss",new Locale("en","US"));
  2134 + //dateDt=dateWithThaiYear(formatter.format(dateNew));
  2135 + dateDt=formatter.format(dateNew);
  2136 + String date1[]= dateDt.split(" ");
  2137 + int str1=0;
  2138 + if(date1.length>=2){
  2139 + String date2[]=date1[0].split("/");
  2140 + if(date2.length>=3){
  2141 + str1=Integer.parseInt(date2[2])+543;
  2142 + }
  2143 + dateDt=date2[0]+"/"+date2[1]+"/"+str1+" "+date1[1];
  2144 + }
  2145 + }catch(ParseException e){
  2146 + e.printStackTrace();
  2147 + }
  2148 + return dateDt;
  2149 + }
  2150 +
  2151 + public static String convertStringDateTimeToStringFormatEn(String date){
  2152 + String dateDt="";
  2153 + try{
  2154 + DateFormat formatter;
  2155 + Date dateNew;
  2156 + formatter=new SimpleDateFormat("ddMMyyyy HH:mm:ss",new Locale("en","US"));
  2157 + dateNew=(Date)formatter.parse(date);
  2158 + formatter=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss",new Locale("en","US"));
  2159 + //dateDt=dateWithThaiYear(formatter.format(dateNew));
  2160 + dateDt=formatter.format(dateNew);
  2161 +
  2162 + }catch(ParseException e){
  2163 + e.printStackTrace();
  2164 + }
  2165 + return dateDt;
  2166 + }
  2167 + public static String convertStringTimeStampToStringFormat(String date){
  2168 + String dateDt="";
  2169 + try{
  2170 + DateFormat formatter;
  2171 + Date dateNew;
  2172 + formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",new Locale("en","US"));
  2173 + dateNew=(Date)formatter.parse(date);
  2174 + formatter=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss",new Locale("en","US"));
  2175 + //dateDt=dateWithThaiYear(formatter.format(dateNew));
  2176 + dateDt=formatter.format(dateNew);
  2177 + String date1[]= dateDt.split(" ");
  2178 + int str1=0;
  2179 + if(date1.length>=2){
  2180 + String date2[]=date1[0].split("/");
  2181 + if(date2.length>=3){
  2182 + str1=Integer.parseInt(date2[2])+543;
  2183 + }
  2184 + dateDt=date2[0]+"/"+date2[1]+"/"+str1+" "+date1[1];
  2185 + }
  2186 + }catch(ParseException e){
  2187 + e.printStackTrace();
  2188 + }
  2189 + return dateDt;
  2190 + }
  2191 +
  2192 + public static String convertStringTimeStampToStringFormatEn(String date){
  2193 + String dateDt="";
  2194 + try{
  2195 + DateFormat formatter;
  2196 + Date dateNew;
  2197 + formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",new Locale("en","US"));
  2198 + dateNew=(Date)formatter.parse(date);
  2199 + formatter=new SimpleDateFormat("dd/MM/yyyy HH:mm:ss",new Locale("en","US"));
  2200 + //dateDt=dateWithThaiYear(formatter.format(dateNew));
  2201 + dateDt=formatter.format(dateNew);
  2202 +
  2203 + }catch(ParseException e){
  2204 + e.printStackTrace();
  2205 + }
  2206 + return dateDt;
  2207 + }
  2208 +
  2209 + public static String dateTimeThai(String strDate){
  2210 + Date tempDate = DateUtil.stringToDate(strDate, "MM/dd/yyyy HH:mm:ss");
  2211 + String[] tempSplit = strDate.split(" ");
  2212 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2213 + String strFullDate = tempDate.getDate() + " " + getMonthThai(tempDate.getMonth()+1) + " " + (tempDate.getYear() +2443) + " " + tempTime;
  2214 + return strFullDate;
  2215 + }
  2216 +
  2217 + public static String dateTimeEng(String strDate){
  2218 + Date tempDate = DateUtil.stringToDate(strDate, "MM/dd/yyyy HH:mm:ss");
  2219 + String[] tempSplit = strDate.split(" ");
  2220 + String tempTime = tempSplit[1]==null?"":tempSplit[1];
  2221 + String strFullDate = tempDate.getDate() + " " + getMonthEng(tempDate.getMonth()+1) + " " + (tempDate.getYear() +1900) + " " + tempTime;
  2222 + return strFullDate;
  2223 + }
  2224 +
  2225 + public static int countDay(Date startDate, Date endDate) throws NullPointerException {
  2226 + if(endDate==null)
  2227 + throw new NullPointerException("DateUtil.countDay().endDate:null");
  2228 + if(startDate==null)
  2229 + throw new NullPointerException("DateUtil.countDay().startDate:null");
  2230 + return (int)( (startDate.getTime() - endDate.getTime()) / (86400000) )+1;
  2231 + }
  2232 +
  2233 +
  2234 + public static boolean betweenCurrentTime(String start,String end,String pattern) throws ParseException{
  2235 + Calendar current = DateUtil.getCurrentDateTime();
  2236 + SimpleDateFormat sf = new SimpleDateFormat(pattern);
  2237 + String currentStr = sf.format(current.getTime());
  2238 + Date currentTime = sf.parse(currentStr);
  2239 + Date startTime = sf.parse(start);
  2240 + Date endTime = sf.parse(end);
  2241 + current.setTime(currentTime);
  2242 + Calendar startCalendar = DateUtil.getCurrentDateTime();
  2243 + startCalendar.setTime(startTime);
  2244 + Calendar endCalendar = DateUtil.getCurrentDateTime();
  2245 + endCalendar.setTime(endTime);
  2246 + if(startCalendar.compareTo(endCalendar)<=0)
  2247 + return current.compareTo(startCalendar)>=0&&current.compareTo(endCalendar)<=0;
  2248 + else
  2249 + return current.compareTo(startCalendar)>=0||current.compareTo(endCalendar)<=0;
  2250 + }
  2251 +
  2252 + /**
  2253 + * calculates the last date of a month
  2254 + */
  2255 +
  2256 + public static Integer calculateMonthEndDate(int month, int year) {
  2257 + int[] daysInAMonth = { 29, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  2258 + int day = daysInAMonth[month];
  2259 + boolean isLeapYear = new GregorianCalendar().isLeapYear(year);
  2260 +
  2261 + if (isLeapYear && month == 2) {
  2262 + day++;
  2263 + }
  2264 +
  2265 + GregorianCalendar gc = new GregorianCalendar(year, month - 1, day);
  2266 +
  2267 + java.sql.Date monthEndDate = new java.sql.Date(gc.getTime().getTime());
  2268 +
  2269 + return monthEndDate.getDate();
  2270 + }
  2271 +
  2272 +
  2273 + public static boolean checkBillCycle(String lastInvStartDateStr, String lastInvEndDateStr, String billCycle) {
  2274 + boolean result = false;
  2275 + try {
  2276 +
  2277 + int lastInvStartDate = Integer.parseInt(lastInvStartDateStr.split("/")[0].trim());
  2278 + int lastInvEndDate = Integer.parseInt(lastInvEndDateStr.split("/")[0].trim());
  2279 + int calculatedDate = calculateMonthEndDate(Integer.parseInt(lastInvEndDateStr.split("/")[1].trim()), Integer.parseInt(lastInvEndDateStr.split("/")[2].trim()));
  2280 + String billCycleSelect = billCycle!=null?billCycle:"";
  2281 + String cycleType = billCycleSelect;
  2282 + cycleType = cycleType.replace("Cycle ", "");
  2283 +
  2284 + String[] temp = cycleType.split("/");
  2285 + int cycleStartDay = Integer.parseInt( ((String)temp[0]).split("-")[0].toString() );
  2286 + int cycleEndDay = Integer.parseInt( ((String)temp[0]).split("-")[1].toString() );
  2287 +
  2288 + DateFormat df = new SimpleDateFormat ("dd/MM/yyyy");
  2289 + Date d1 = df.parse(lastInvStartDateStr);
  2290 + Date d2 = df.parse(lastInvEndDateStr);
  2291 +
  2292 + String checkLastInv = String.valueOf(lastInvStartDate)+"-"+String.valueOf(lastInvEndDate);
  2293 + String checkCycleBill = String.valueOf(cycleStartDay)+"-"+String.valueOf(cycleEndDay);
  2294 +
  2295 + if(!d1.after(d2)){
  2296 +
  2297 + if((!checkLastInv.equals(checkCycleBill)) && (!checkCycleBill.equals("1-30")) ){
  2298 +
  2299 + return result = false;
  2300 +
  2301 + }else{
  2302 +
  2303 + if( (lastInvStartDate==cycleStartDay)&&(lastInvEndDate==cycleEndDay) ){
  2304 +
  2305 + if(checkCycleBill.equals("1-30") ){
  2306 +
  2307 + if(calculatedDate == cycleEndDay){
  2308 + return result = true;
  2309 + }else{
  2310 + return result = false;
  2311 + }
  2312 +
  2313 + }else{
  2314 + return result = true;
  2315 + }
  2316 +
  2317 + }
  2318 +
  2319 + if((lastInvStartDate==cycleStartDay)&&(lastInvEndDate==calculatedDate) ){
  2320 +
  2321 + result = true;
  2322 + }else{
  2323 + result = false;
  2324 + }
  2325 +
  2326 + }
  2327 +
  2328 +
  2329 +
  2330 + }else{
  2331 +
  2332 + result = false;
  2333 + }
  2334 +
  2335 + } catch (ParseException e) {
  2336 +
  2337 + e.printStackTrace();
  2338 + }
  2339 +
  2340 + return result;
  2341 + }
  2342 +}
... ...
src/th/co/ais/ssbsrfc/utils/ERDData.java 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +package th.co.ais.ssbsrfc.utils;
  2 +
  3 +import org.simpleframework.xml.Attribute;
  4 +import org.simpleframework.xml.Root;
  5 +import org.simpleframework.xml.Text;
  6 +
  7 +@Root(name="ERDData")
  8 +public class ERDData {
  9 + @Attribute(required=false)
  10 + private String value;
  11 +
  12 + @Text(required=false)
  13 + private String text;
  14 +
  15 + public String getValue() {
  16 + return value;
  17 + }
  18 +
  19 + public void setValue(String value) {
  20 + this.value = value;
  21 + }
  22 +
  23 + public String getText() {
  24 + return text;
  25 + }
  26 +
  27 + public void setText(String text) {
  28 + this.text = text;
  29 + }
  30 +
  31 +
  32 +}
... ...
src/th/co/ais/ssbsrfc/utils/ERDHeader.java 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +package th.co.ais.ssbsrfc.utils;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.simpleframework.xml.ElementList;
  6 +import org.simpleframework.xml.ElementListUnion;
  7 +import org.simpleframework.xml.Root;
  8 +
  9 +@Root(name="ERDHeader")
  10 +public class ERDHeader {
  11 + @ElementListUnion({
  12 + @ElementList(entry="Header", inline=true, required=false)
  13 + })
  14 + private List<Header> header;
  15 +
  16 + public void setHeader(List<Header> header) {
  17 + this.header = header;
  18 + }
  19 +
  20 + public List<Header> getHeader() {
  21 + return header;
  22 + }
  23 +}
... ...
src/th/co/ais/ssbsrfc/utils/EqxStringUtils.java 0 → 100644
... ... @@ -0,0 +1,159 @@
  1 +package th.co.ais.ssbsrfc.utils;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.apache.commons.lang.StringEscapeUtils;
  8 +import org.simpleframework.xml.Serializer;
  9 +import org.simpleframework.xml.core.Persister;
  10 +
  11 +import th.co.ais.ssbsrfc.instance.EC02Instance;
  12 +import ec02.af.data.EquinoxRawData;
  13 +import ec02.utils.AppLog;
  14 +
  15 +public class EqxStringUtils {
  16 +
  17 + public static Map <String, String> convertXMLtoHttpData(String rcvXMLData) throws Exception{
  18 + Map <String, String> rtnMapHttpData = new HashMap<String, String>();
  19 +
  20 + if(rcvXMLData != null) {
  21 + Serializer serializer = new Persister();
  22 + rcvXMLData = "<HttpData>" + rcvXMLData + "</HttpData>";
  23 + HttpData httpData = serializer.read(HttpData.class, rcvXMLData);
  24 + if(httpData != null ) {
  25 + if(httpData.getErdData() != null
  26 + && httpData.getErdData().getValue() != null) {
  27 + rtnMapHttpData.put("erddata_value", httpData.getErdData().getValue());
  28 + } else {
  29 + rtnMapHttpData.put("erddata_value", rcvXMLData);
  30 + }
  31 +
  32 + ERDHeader eRDHeader = httpData.getErdHeader();
  33 + if(eRDHeader != null) {
  34 + List<Header> lsHeader = eRDHeader.getHeader();
  35 +
  36 + if(lsHeader != null) {
  37 + for(int i = 0; i < lsHeader.size(); i++) {
  38 + Header header = lsHeader.get(i);
  39 +
  40 + if(header.getName() != null) {
  41 + rtnMapHttpData.put(header.getName(), header.getValue());
  42 + }
  43 + }
  44 + }
  45 + }
  46 + }
  47 + }
  48 + return rtnMapHttpData;
  49 + }
  50 +
  51 + public static String getMessage(EquinoxRawData equinoxRawData) {
  52 + String value = EqxStringUtils.getMessage(equinoxRawData, null);
  53 + return value;
  54 + }
  55 +
  56 + public static String getMessage(EquinoxRawData equinoxRawData, EC02Instance ec02Instance) {
  57 + String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance, false);
  58 + return value;
  59 + }
  60 +
  61 + public static String getMessage(EquinoxRawData equinoxRawData, EC02Instance ec02Instance, boolean isLog) {
  62 + String value = "";
  63 + try {
  64 + String ctype = equinoxRawData.getRawDataAttribute("ctype");
  65 + String val = equinoxRawData.getRawDataAttribute("val");
  66 + String message = equinoxRawData.getRawDataMessage();
  67 + if (ctype.equals("Specialized-Resource")) {
  68 + value = message;
  69 + if (isLog) {
  70 + AppLog.d("[GETMESSAGE(MESSAGE)]: " + value);
  71 + }
  72 + } else if (ctype.equals("text/xml")) {
  73 + if ((message == null || message.equals("")) && (val != null && !val.equals(""))) {
  74 + value = val;
  75 + if (isLog) {
  76 + AppLog.d("[GETMESSAGE(VAL)]: " + value);
  77 + }
  78 + } else if (message != null && !message.equals("")) {
  79 + value = EqxStringUtils.getERDData(message, ec02Instance);
  80 + if (isLog) {
  81 + AppLog.d("[GETMESSAGE(MESSAGE)]: " + value);
  82 + }
  83 + }
  84 + } else if (ctype.equals("filefeed")) {
  85 + value = message;
  86 + } else if (ctype.equals("unknown")) {
  87 + value = message;
  88 + } else {
  89 + if ((val == null || val.equals("")) && (message != null && !message.equals(""))) {
  90 + value = EqxStringUtils.getERDData(message, ec02Instance);
  91 + if (isLog) {
  92 + AppLog.d("[GETMESSAGE(MESSAGE)]: " + value);
  93 + }
  94 + } else {
  95 + value = val;
  96 + if (isLog) {
  97 + AppLog.d("[GETMESSAGE(VAL)]: " + value);
  98 + }
  99 + }
  100 + }
  101 + } catch (Exception e) {
  102 + AppLog.e("[ EXCEPTION GETMESSAGES ] : " + e);
  103 + }
  104 + return value;
  105 + }
  106 +
  107 + public static String getERDData(String message, EC02Instance ec02Instance) {
  108 + String value = "";
  109 + try {
  110 + Map<String, String> mapHttpData = EqxStringUtils.convertXMLtoHttpData(message);
  111 + value = mapHttpData.get("erddata_value");
  112 + if (ec02Instance != null) {
  113 + ec02Instance.getAFInstance().setMapHttpData(mapHttpData);
  114 + }
  115 + } catch (Exception e) {
  116 +// AppLog.e("[ Exception convertXMLtoHttpData ] : " + e.getMessage());
  117 +// AppLog.d("## convertXMLtoHttpData: NOTMATH");
  118 + value = message;
  119 + }
  120 + return value;
  121 + }
  122 +
  123 + public static String builMessageERDHeader(EC02Instance ec02Instance, String value) {
  124 + String buil = "\n\t\t<ERDHeader>\n";
  125 + Map<String, String> map = ec02Instance.getAFInstance().getMapHttpData();
  126 + if (map != null) {
  127 + for (Map.Entry<String, String> entry : map.entrySet())
  128 + {
  129 + String name = entry.getKey();
  130 + String data = entry.getValue();
  131 + if (!name.equals("Content-Type") && !name.equals("erddata_value") && !name.equals("Content-Length")) {
  132 + buil += "\t\t\t<Header name=\"" + name + "\" value=\"" + data + "\" />\n";
  133 + }
  134 + }
  135 + }
  136 +// buil += "<Header name=\"Content-Type\" value=\"application/json\" />\n";
  137 + buil += "\t\t</ERDHeader>\n";
  138 + buil += "\t\t<ERDData value=\"" + EqxStringUtils.escapePostdata(value) + "\" />";
  139 + return buil;
  140 + }
  141 +
  142 + public static String escapePostdata(String rcvData) {
  143 + if(rcvData != null ) {
  144 + return StringEscapeUtils.escapeXml(rcvData);
  145 + } else {
  146 + return null;
  147 + }
  148 + }
  149 +
  150 + public static String unescapePostdata(String rcvData) {
  151 + if(rcvData != null ) {
  152 + //return rcvData;
  153 + return StringEscapeUtils.unescapeXml(rcvData);
  154 +
  155 + } else {
  156 + return null;
  157 + }
  158 + }
  159 +}
0 160 \ No newline at end of file
... ...