Commit cdeba25a by everdarkgreen

JsonNode: (draft12) production adaptation

parent 34167fae
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<libraries xmlns="http://www.netbeans.org/ns/cdnjs-libraries/1"/>
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.6-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>JBoss4</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.jdkPlatform>JDK_1.7</netbeans.hint.jdkPlatform>
<org-netbeans-modules-css-prep.less_2e_mappings>/less:/css</org-netbeans-modules-css-prep.less_2e_mappings>
<org-netbeans-modules-css-prep.less_2e_enabled>false</org-netbeans-modules-css-prep.less_2e_enabled>
<org-netbeans-modules-css-prep.sass_2e_enabled>false</org-netbeans-modules-css-prep.sass_2e_enabled>
<org-netbeans-modules-css-prep.sass_2e_compiler_2e_options/>
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
<org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings>
<org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>js/libs</org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
</properties>
</project-shared-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>build</actionName>
<packagings>
<packaging>*</packaging>
</packagings>
<goals>
<goal>install</goal>
<goal>checkstyle:check</goal>
</goals>
</action>
</actions>
...@@ -104,8 +104,9 @@ ...@@ -104,8 +104,9 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven.checkstyle.plugin.version}</version>
<configuration> <configuration>
<configLocation>config/sun_checks.xml</configLocation> <configLocation>config/google_checks.xml</configLocation>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
......
...@@ -58,7 +58,7 @@ public class Main implements MessageListener { ...@@ -58,7 +58,7 @@ public class Main implements MessageListener {
private String executionID = null; // идентификатор блокирующего процесса private String executionID = null; // идентификатор блокирующего процесса
private String documentID = null; // идентификатор документа реестра private String documentID = null; // идентификатор документа реестра
private static final String LOGIN = "111111"; private static final String LOGIN = "Ипатьев";
private static final String PASSWORD = "1"; private static final String PASSWORD = "1";
private final String TARGET_FORM_UUID = "fb44d99d-1579-4ac3-884a-01a6d4f71f9c"; private final String TARGET_FORM_UUID = "fb44d99d-1579-4ac3-884a-01a6d4f71f9c";
private final String SYNERGY_ADDRESS = "http://127.0.0.1:8080/Synergy"; private final String SYNERGY_ADDRESS = "http://127.0.0.1:8080/Synergy";
...@@ -142,70 +142,67 @@ public class Main implements MessageListener { ...@@ -142,70 +142,67 @@ public class Main implements MessageListener {
} }
targetFormData = OBJECT_MAPPER.readValue(TargetRootDataNode, new TypeReference<List<AsNode>>() {}); targetFormData = OBJECT_MAPPER.readValue(TargetRootDataNode, new TypeReference<List<AsNode>>() {});
// Получение значений текущих дат исходной формы // common vacation period
String b5b1; String dateStart = getComponentValueByID(this.sourceFormData, "date_start", FieldType.KEY);
String dateFinish = getComponentValueByID(this.sourceFormData, "date_finish", FieldType.KEY);
String t2b1; if (dateStart == null || dateFinish == null) {
String t8b1; throw new Exception("Vacation period is not specified");
}
// String t18b1, t20b1, t16b1;
// String t26b1, t24b1, t22b1;
// String t32b1, t30b1, t28b1;
// first table // first table
String b2b1 = getComponentValueByID(this.sourceFormData, "b2-b1-b1", FieldType.KEY); String b2b1 = getComponentValueByID(this.sourceFormData, "b2-b1", FieldType.KEY);
String b4b1 = getComponentValueByID(this.sourceFormData, "b4-b1-b1", FieldType.KEY); String b4b1 = getComponentValueByID(this.sourceFormData, "b4-b1", FieldType.KEY);
if (b2b1 == null || b4b1 == null) { // отображается key if (notNull(b2b1, b4b1)) { // отображается key
throw new Exception ("Source date fields is empty"); constructNewTableRow(b2b1, b4b1, dateStart, dateFinish);
} else {
constructNewTableRow(b2b1, b4b1);
updateTargetForm(); updateTargetForm();
return;
} }
String t4b1 = getComponentValueByID(this.sourceFormData, "t4-b1", FieldType.KEY);
String t6b1 = getComponentValueByID(this.sourceFormData, "t6-b1", FieldType.KEY);
String t10b1 = getComponentValueByID(this.sourceFormData, "t10-b1", FieldType.KEY);
String t12b1 = getComponentValueByID(this.sourceFormData, "t12-b1", FieldType.KEY);
if (notNull(t4b1, t6b1, t10b1, t12b1)) {
constructNewTableRow(t4b1, t6b1, dateStart, dateFinish);
constructNewTableRow(t10b1, t12b1, dateStart, dateFinish);
updateTargetForm();
return;
}
// boolean key_b2b1 = false, key_b4b1 = false, val_b2b1 = false, val_b4b1 = false; String t18b1 = getComponentValueByID(this.sourceFormData, "t18-b1", FieldType.KEY);
// if (!b2b1.isEmpty() && !b4b1.isEmpty()) { // do not update with empty values String t20b1 = getComponentValueByID(this.sourceFormData, "t20-b1", FieldType.KEY);
// key_b2b1 = updateFieldValue(this.targetFormData, "start-b1", FieldType.KEY, b2b1); String t24b1 = getComponentValueByID(this.sourceFormData, "t24-b1", FieldType.KEY);
// key_b4b1 = updateFieldValue(this.targetFormData, "finish-b1", FieldType.KEY, b4b1); String t26b1 = getComponentValueByID(this.sourceFormData, "t26-b1", FieldType.KEY);
// val_b2b1 = updateFieldValue(this.targetFormData, "start-b1", FieldType.VALUE, dateValueFromKey(b2b1)); String t30b1 = getComponentValueByID(this.sourceFormData, "t30-b1", FieldType.KEY);
// val_b4b1 = updateFieldValue(this.targetFormData, "finish-b1", FieldType.VALUE, dateValueFromKey(b4b1)); String t32b1 = getComponentValueByID(this.sourceFormData, "t32-b1", FieldType.KEY);
// }
//
// if (key_b2b1 && key_b4b1 && val_b2b1 && val_b4b1) {
// updateTargetForm();
// }
// Second table
// String t4b1 = getComponentValueByID(sourceFormData, "t2-b1", ObjectType.DATE);
// String t6b1 = getComponentValueByID(sourceFormData, "b6-b1", ObjectType.DATE);
// String t10b1 = getComponentValueByID(sourceFormData, "t10-b1", ObjectType.DATE);
// String t12b1 = getComponentValueByID(sourceFormData, "t12-b1", ObjectType.DATE);
//
// if (!t4b1.isEmpty() && !t6b1.isEmpty() && !t10b1.isEmpty() && !t12b1.isEmpty()) {
// setComponentValueByID(targetFormData, "start-b1", "key", b2b1);
// setComponentValueByID(targetFormData, "start-b1", "key", b2b1);
// setComponentValueByID(targetFormData, "start-b1", "key", b2b1);
// setComponentValueByID(targetFormData, "start-b1", "key", b2b1);
//
// unlockRoute();
// return;
// }
// Разблокировка маршрута
if (notNull(t18b1, t20b1, t24b1, t26b1, t30b1, t32b1)) {
constructNewTableRow(t18b1, t20b1, dateStart, dateFinish);
constructNewTableRow(t24b1, t26b1, dateStart, dateFinish);
constructNewTableRow(t30b1, t32b1, dateStart, dateFinish);
updateTargetForm();
return;
}
} catch (Exception exc) { } catch (Exception exc) {
LOGGER.error(exc.getMessage(), exc); LOGGER.error(exc.getMessage(), exc);
} finally { } finally {
unlockRoute(); unlockRoute(); // Разблокировка маршрута
}
} }
private static boolean notNull(Object... args) {
for (Object arg : args) {
if (arg == null) {
return false;
}
}
return true;
} }
private void constructNewTableRow(String b2b1, String b4b1) throws Exception { private void constructNewTableRow(String vacStart, String vacEnd, String perStart, String perEnd) throws Exception {
AsNode tableNode = findNode(targetFormData, "table"); AsNode tableNode = findNode(targetFormData, "table");
if (tableNode != null) { if (tableNode != null) {
List<AsNode> tableDataNodesList = tableNode.getData(); List<AsNode> tableDataNodesList = tableNode.getData();
...@@ -222,19 +219,20 @@ public class Main implements MessageListener { ...@@ -222,19 +219,20 @@ public class Main implements MessageListener {
n1.setId("start-b" + tablesCounter); n1.setId("start-b" + tablesCounter);
n1.setType("date"); n1.setType("date");
n1.setLabel(" "); n1.setLabel(" ");
n1.setValue(dateValueFromKey(b2b1)); n1.setValue(dateValueFromKey(vacStart));
n1.setKey(b2b1); n1.setKey(vacStart);
n2.setId("finish-b" + tablesCounter); n2.setId("finish-b" + tablesCounter);
n2.setType("date"); n2.setType("date");
n2.setLabel(" "); n2.setLabel(" ");
n2.setValue(dateValueFromKey(b4b1)); n2.setValue(dateValueFromKey(vacEnd));
n2.setKey(b4b1); n2.setKey(vacEnd);
n3.setId("days-b" + tablesCounter); n3.setId("days-b" + tablesCounter);
n3.setType("textbox"); n3.setType("textbox");
n3.setLabel(" "); n3.setLabel(" ");
n3.setValue(Integer.toString(dateDiffToDays(b2b1, b4b1))); // n3.setValue(Integer.toString(dateDiffToDays(b2b1, b4b1)));
n3.setValue("");
n4.setId("matpom-b" + tablesCounter); n4.setId("matpom-b" + tablesCounter);
n4.setType("listbox"); n4.setType("listbox");
...@@ -243,9 +241,13 @@ public class Main implements MessageListener { ...@@ -243,9 +241,13 @@ public class Main implements MessageListener {
n5.setId("period_start-b" + tablesCounter); n5.setId("period_start-b" + tablesCounter);
n5.setType("date"); n5.setType("date");
n5.setValue(dateValueFromKey(perStart));
n5.setKey(perStart);
n6.setId("period_finish-b" + tablesCounter); n6.setId("period_finish-b" + tablesCounter);
n6.setType("date"); n6.setType("date");
n6.setValue(dateValueFromKey(perEnd));
n6.setKey(perEnd);
n7.setId("otozvano-b" + tablesCounter); n7.setId("otozvano-b" + tablesCounter);
n7.setType("texbox"); n7.setType("texbox");
......
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/cwm</context-root>
</jboss-web>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment